ActionScheduler_wpPostStore::log_execution()publicWC 1.0

Log Execution.

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

Хуков нет.

Возвращает

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

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

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

Код ActionScheduler_wpPostStore::log_execution() WC 9.4.2

public function log_execution( $action_id ) {
	/**
	 * Global wpdb object.
	 *
	 * @var wpdb $wpdb
	 */
	global $wpdb;

	// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
	$status_updated = $wpdb->query(
		$wpdb->prepare(
			"UPDATE {$wpdb->posts} SET menu_order = menu_order+1, post_status=%s, post_modified_gmt = %s, post_modified = %s WHERE ID = %d AND post_type = %s",
			self::STATUS_RUNNING,
			current_time( 'mysql', true ),
			current_time( 'mysql' ),
			$action_id,
			self::POST_TYPE
		)
	);

	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
			)
		);
	}
}