>get_date() : $scheduled_date;
if ( ! $next ) {
return '0000-00-00 00:00:00';
}
$next->setTimezone( new DateTimeZone( 'UTC' ) );
return $next->format( 'Y-m-d H:i:s' );
}
/**
* Get the time MySQL formated date/time string for an action's (next) scheduled date.
*
* @param ActionScheduler_Action $action
* @param DateTime $scheduled_date (optional)
* @return string
*/
protected function get_scheduled_date_string_local( ActionScheduler_Action $action, DateTime $scheduled_date = NULL ) {
$next = null === $scheduled_date ? $action->get_schedule()->get_date() : $scheduled_date;
if ( ! $next ) {
return '0000-00-00 00:00:00';
}
ActionScheduler_TimezoneHelper::set_local_timezone( $next );
return $next->format( 'Y-m-d H:i:s' );
}
/**
* Validate that we could decode action arguments.
*
* @param mixed $args The decoded arguments.
* @param int $action_id The action ID.
*
* @throws ActionScheduler_InvalidActionException When the decoded arguments are invalid.
*/
protected function validate_args( $args, $action_id ) {
// Ensure we have an array of args.
if ( ! is_array( $args ) ) {
throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id );
}
// Validate JSON decoding if possible.
if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) {
throw ActionScheduler_InvalidActionException::from_decoding_args( $action_id, $args );
}
}
/**
* Validate a ActionScheduler_Schedule object.
*
* @param mixed $schedule The unserialized ActionScheduler_Schedule object.
* @param int $action_id The action ID.
*
* @throws ActionScheduler_InvalidActionException When the schedule is invalid.
*/
protected function validate_schedule( $schedule, $action_id ) {
if ( empty( $schedule ) || ! is_a( $schedule, 'ActionScheduler_Schedule' ) ) {
throw ActionScheduler_InvalidActionException::from_schedule( $action_id, $schedule );
}
}
/**
* InnoDB indexes have a maximum size of 767 bytes by default, which is only 191 characters with utf8mb4.
*
* Previously, AS wasn't concerned about args length, as we used the (unindex) post_content column. However,
* with custom tables, we use an indexed VARCHAR column instead.
*
* @param ActionScheduler_Action $action Action to be validated.
* @throws InvalidArgumentException When json encoded args is too long.
*/
protected function validate_action( ActionScheduler_Action $action ) {
if ( strlen( json_encode( $action->get_args() ) ) > static::$max_args_length ) {
throw new InvalidArgumentException( sprintf( __( 'ActionScheduler_Action::$args too long. To ensure the args column can be indexed, action args should not be more than %d characters when encoded as JSON.', 'woocommerce' ), static::$max_args_length ) );
}
}
/**
* Cancel pending actions by hook.
*
* @since 3.0.0
*
* @param string $hook Hook name.
*
* @return void
*/
public function cancel_actions_by_hook( $hook ) {
$action_ids = true;
while ( ! empty( $action_ids ) ) {
$action_ids = $this->query_actions(
array(
'hook' => $hook,
'status' => self::STATUS_PENDING,
'per_page' => 1000,
)
);
$this->bulk_cancel_actions( $action_ids );
}
}
/**
* Cancel pending actions by group.
*
* @since 3.0.0
*
* @param string $group Group slug.
*
* @return void
*/
public function cancel_actions_by_group( $group ) {
$action_ids = true;
while ( ! empty( $action_ids ) ) {
$action_ids = $this->query_actions(
array(
'group' => $group,
'status' => self::STATUS_PENDING,
'per_page' => 1000,
)
);
$this->bulk_cancel_actions( $action_ids );
}
}
/**
* Cancel a set of action IDs.
*
* @since 3.0.0
*
* @param array $action_ids List of action IDs.
*
* @return void
*/
private function bulk_cancel_actions( $action_ids ) {
foreach ( $action_ids as $action_id ) {
$this->cancel_action( $action_id );
}
do_action( 'action_scheduler_bulk_cancel_actions', $action_ids );
}
/**
* @return array
*/
public function get_status_labels() {
return array(
self::STATUS_COMPLETE => __( 'Complete', 'woocommerce' ),
self::STATUS_PENDING => __( 'Pending', 'woocommerce' ),
self::STATUS_RUNNING => __( 'In-progress', 'woocommerce' ),
self::STATUS_FAILED => __( 'Failed', 'woocommerce' ),
self::STATUS_CANCELED => __( 'Canceled', 'woocommerce' ),
);
}
/**
* Check if there are any pending scheduled actions due to run.
*
* @param ActionScheduler_Action $action
* @param DateTime $scheduled_date (optional)
* @return string
*/
public function has_pending_actions_due() {
$pending_actions = $this->query_actions( array(
'date' => as_get_datetime_object(),
'status' => ActionScheduler_Store::STATUS_PENDING,
) );
return ! empty( $pending_actions );
}
/**
* Callable initialization function optionally overridden in derived classes.
*/
public function init() {}
/**
* Callable function to mark an action as migrated optionally overridden in derived classes.
*/
public function mark_migrated( $action_id ) {}
/**
* @return ActionScheduler_Store
*/
public static function instance() {
if ( empty( self::$store ) ) {
$class = apply_filters( 'action_scheduler_store_class', self::DEFAULT_CLASS );
self::$store = new $class();
}
return self::$store;
}
}
Fatal error: Uncaught Error: Class 'ActionScheduler_Store' not found in /var/www/html/brimpecas.com.br/web/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler.php:25
Stack trace:
#0 /var/www/html/brimpecas.com.br/web/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler.php(145): ActionScheduler::store()
#1 /var/www/html/brimpecas.com.br/web/wp-content/plugins/woocommerce/packages/action-scheduler/action-scheduler.php(44): ActionScheduler::init('/var/www/html/b...')
#2 /var/www/html/brimpecas.com.br/web/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_Versions.php(59): action_scheduler_initialize_3_dot_1_dot_6()
#3 /var/www/html/brimpecas.com.br/web/wp-includes/class-wp-hook.php(322): ActionScheduler_Versions::initialize_latest_version()
#4 /var/www/html/brimpecas.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#5 /var/www/html/brimpecas.com.br/web/wp-includes/plugin.php(517): WP_H in /var/www/html/brimpecas.com.br/web/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler.php on line 25