Automator_DB_Handler_Triggers::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-triggers.php

	public function delete_logs( $recipe_id, $automator_recipe_log_id ) {
		global $wpdb;
		$trigger_tbl      = $wpdb->prefix . Automator()->db->tables->trigger;
		$trigger_meta_tbl = $wpdb->prefix . Automator()->db->tables->trigger_meta;
		$triggers         = $wpdb->get_col( $wpdb->prepare( "SELECT `ID` FROM $trigger_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 ( $triggers ) {
			foreach ( $triggers as $automator_trigger_log_id ) {
				// delete from uap_trigger_log_meta
				$wpdb->delete(
					$trigger_meta_tbl,
					array( 'automator_trigger_log_id' => $automator_trigger_log_id )
				);
			}
		}
		// delete from uap_trigger_log
		$wpdb->delete(
			$trigger_tbl,
			array(
				'automator_recipe_id'     => $recipe_id,
				'automator_recipe_log_id' => $automator_recipe_log_id,
			)
		);
	}