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 8.7.0

public function get_status( $action_id ) {
	/** @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 ( 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;
	}
}