Automator_DB_Handler_Actions::delete_logs( $recipe_id,  $automator_recipe_log_id )


Parameters Parameters

$recipe_id

(Required)

$automator_recipe_log_id

(Required)


Source Source

File: src/core/lib/utilities/db/class-automator-db-handler-actions.php

	public function delete_logs( $recipe_id, $automator_recipe_log_id ) {
		global $wpdb;
		$action_tbl      = $wpdb->prefix . Automator()->db->tables->action;
		$action_meta_tbl = $wpdb->prefix . Automator()->db->tables->action_meta;
		$actions         = $wpdb->get_col( $wpdb->prepare( "SELECT `ID` FROM $action_tbl WHERE automator_recipe_id=%d AND automator_recipe_log_id=%d", $recipe_id, $automator_recipe_log_id ) ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
		if ( $actions ) {
			foreach ( $actions as $automator_action_log_id ) {
				// delete from uap_action_log_meta
				$wpdb->delete(
					$action_meta_tbl,
					array( 'automator_action_log_id' => $automator_action_log_id )
				);
			}
		}

		// delete from uap_action_log
		$wpdb->delete(
			$action_tbl,
			array(
				'automator_recipe_id'     => $recipe_id,
				'automator_recipe_log_id' => $automator_recipe_log_id,
			)
		);
	}