ActionScheduler_DBStore::get_status()publicWC 1.0

Get an action's status.

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

Хуков нет.

Возвращает

Строку.

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

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

Код ActionScheduler_DBStore::get_status() WC 9.8.1

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

	$sql    = "SELECT status FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d";
	$sql    = $wpdb->prepare( $sql, $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
	$status = $wpdb->get_var( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

	if ( is_null( $status ) ) {
		throw new \InvalidArgumentException( __( 'Invalid action ID. No status found.', 'woocommerce' ) );
	} elseif ( empty( $status ) ) {
		throw new \RuntimeException( __( 'Unknown status found for action.', 'woocommerce' ) );
	} else {
		return $status;
	}
}