ActionScheduler_DBStore::get_status
Get an action's status.
Method of the class: ActionScheduler_DBStore{}
No Hooks.
Returns
String.
Usage
$ActionScheduler_DBStore = new ActionScheduler_DBStore(); $ActionScheduler_DBStore->get_status( $action_id );
- $action_id(int) (required)
- Action ID.
ActionScheduler_DBStore::get_status() ActionScheduler DBStore::get status code WC 10.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;
}
}