ActionScheduler_QueueCleaner::delete_actions
Delete actions.
Метод класса: ActionScheduler_QueueCleaner{}
Хуки из метода
Возвращает
int[]. Deleted action IDs.
Использование
// private - только в коде основоного (родительского) класса $result = $this->delete_actions( $actions_to_delete, $lifespan, $context );
- $actions_to_delete(int[]) (обязательный)
- List of action IDs to delete.
- $lifespan(int) (обязательный)
- Minimum scheduled age in seconds of the actions being deleted.
- $context(строка)
- Context of the delete request.
По умолчанию:'old'
Код ActionScheduler_QueueCleaner::delete_actions() ActionScheduler QueueCleaner::delete actions WC 11.0.1
private function delete_actions( array $actions_to_delete, $lifespan, $context = 'old' ) {
$deleted_actions = array();
foreach ( $actions_to_delete as $action_id ) {
try {
$this->store->delete_action( $action_id );
$deleted_actions[] = $action_id;
} catch ( Exception $e ) {
/**
* Notify 3rd party code of exceptions when deleting a completed action older than the retention period
*
* This hook provides a way for 3rd party code to log or otherwise handle exceptions relating to their
* actions.
*
* @param int $action_id The scheduled actions ID in the data store
* @param Exception $e The exception thrown when attempting to delete the action from the data store
* @param int $lifespan The retention period, in seconds, for old actions
* @param int $count_of_actions_to_delete The number of old actions being deleted in this batch
* @since 2.0.0
*/
do_action( "action_scheduler_failed_{$context}_action_deletion", $action_id, $e, $lifespan, count( $actions_to_delete ) );
}
}
return $deleted_actions;
}