ActionScheduler_DBStore::log_execution()
Add execution message to action log.
Method of the class: ActionScheduler_DBStore{}
No Hooks.
Return
null
. Nothing (null).
Usage
$ActionScheduler_DBStore = new ActionScheduler_DBStore(); $ActionScheduler_DBStore->log_execution( $action_id );
- $action_id(int) (required)
- Action ID.
ActionScheduler_DBStore::log_execution() ActionScheduler DBStore::log execution code WC 9.4.2
public function log_execution( $action_id ) { /** @var \wpdb $wpdb */ global $wpdb; $sql = "UPDATE {$wpdb->actionscheduler_actions} SET attempts = attempts+1, status=%s, last_attempt_gmt = %s, last_attempt_local = %s WHERE action_id = %d"; $sql = $wpdb->prepare( $sql, self::STATUS_RUNNING, current_time( 'mysql', true ), current_time( 'mysql' ), $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared $status_updated = $wpdb->query( $sql ); if ( ! $status_updated ) { throw new Exception( sprintf( /* translators: 1: action ID. 2: status slug. */ __( 'Unable to update the status of action %1$d to %2$s.', 'woocommerce' ), $action_id, self::STATUS_RUNNING ) ); } }