ActionScheduler_DBStore::log_execution()publicWC 1.0

Add execution message to action log.

Метод класса: ActionScheduler_DBStore{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ActionScheduler_DBStore = new ActionScheduler_DBStore();
$ActionScheduler_DBStore->log_execution( $action_id );
$action_id(int) (обязательный)
Action ID.

Код ActionScheduler_DBStore::log_execution() WC 9.1.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
			)
		);
	}
}