ActionScheduler_DBStore::get_date_gmt
Get the GMT schedule date for an action.
Метод класса: ActionScheduler_DBStore{}
Хуков нет.
Возвращает
\DateTime. The GMT date the action is scheduled to run, or the date that it ran.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_date_gmt( $action_id );
- $action_id(int) (обязательный)
- Action ID.
Код ActionScheduler_DBStore::get_date_gmt() ActionScheduler DBStore::get date gmt WC 10.7.0
protected function get_date_gmt( $action_id ) {
/**
* Global.
*
* @var \wpdb $wpdb
*/
global $wpdb;
$record = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d", $action_id ) );
if ( empty( $record ) ) {
/* translators: %s is the action ID */
throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s: we were unable to determine the date of this action. It may may have been deleted by another process.', 'woocommerce' ), $action_id ) );
}
if ( self::STATUS_PENDING === $record->status ) {
return as_get_datetime_object( $record->scheduled_date_gmt );
} else {
return as_get_datetime_object( $record->last_attempt_gmt );
}
}