\ActionScheduler_WPCLI_Clean_Command

Commands for Action Scheduler.

Summary

Methods
Properties
Constants
clean()
No public properties found
No constants found
print_total_batches()
print_error()
print_success()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

clean()

clean(array  $args, array  $assoc_args) : mixed

Run the Action Scheduler Queue Cleaner

OPTIONS

[--batch-size=<size>] : The maximum number of actions to delete per batch. Defaults to 20.

[--batches=<size>] : Limit execution to a number of batches. Defaults to 0, meaning batches will continue all eligible actions are deleted.

[--status=<status>] : Only clean actions with the specified status. Defaults to Canceled, Completed. Define multiple statuses as a comma separated string (without spaces), e.g. --status=complete,failed,canceled

[--before=<datestring>] : Only delete actions with scheduled date older than this. Defaults to 31 days. e.g --before='7 days ago', --before='02-Feb-2020 20:20:20'

[--pause=<seconds>] : The number of seconds to pause between batches. Default no pause.

Parameters

array $args

Positional arguments.

array $assoc_args

Keyed arguments.

Throws

\WP_CLI\ExitException

When an error occurs.

Returns

mixed

print_total_batches()

print_total_batches(int  $batches_processed) : mixed

Print WP CLI message about how many batches of actions were processed.

Parameters

int $batches_processed

Number of batches processed.

Returns

mixed

print_error()

print_error(\Exception  $e) : mixed

Convert an exception into a WP CLI error.

Parameters

\Exception $e

The error object.

Returns

mixed

print_success()

print_success(int  $actions_deleted) : mixed

Print a success message with the number of completed actions.

Parameters

int $actions_deleted

Number of deleted actions.

Returns

mixed