API / Minn\Cli / CronCommand

CronCommand final class

Minn\Cli\CronCommand · public/minn/src/Minn/Cli/CronCommand.php · 277 lines

`wp cron`: the events, schedules, and spawn test a host and a fleet ask for. Every verb boots the full runtime first, so a plugin's schedules and callbacks are registered before an event is listed, scheduled, or run. The wording and exit codes are the reference's, captured from `wp cron` on the oracle; the two time columns drift second to second and are never pinned.

Uses 1
Used by 1

Constants and properties

privateEVENT_FIELDS = array ( 0 => 'hook', 1 => 'next_run_gmt', 2 => 'next_run_relative', 3 => 'recurrence', )
privateSCHEDULE_FIELDS = array ( 0 => 'name', 1 => 'display', 2 => 'interval', )

Public

methodevent_list(array $args, array $assocArgs): void#

Lists the scheduled cron events.

## OPTIONS

[--hook=<name>] [--field=<field>] [--fields=<fields>] [--format=<format>] [--<field>=<value>] [--due-now]

methodevent_run(array $args, array $assocArgs): void#

Runs the next scheduled cron event for the given hook.

## OPTIONS

[<hook>...] [--due-now] [--all]

methodevent_schedule(array $args, array $assocArgs): void#

Schedules a new cron event.

## OPTIONS

<hook> [<next-run>] [<recurrence>] [--<field>=<value>]

methodevent_delete(array $args, array $assocArgs): void#

Deletes all cron events for the given hook.

## OPTIONS

<hook>...

methodevent_unschedule(array $args, array $assocArgs): void#

Unschedules all cron events for a given hook.

## OPTIONS

<hook>

methodschedule_list(array $args, array $assocArgs): void#

Lists available cron schedules.

## OPTIONS

[--field=<field>] [--fields=<fields>] [--format=<format>]

methodtest(array $args, array $assocArgs): void#

Tests the WP Cron spawning system and reports the results.

Internals 4

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatescheduled(array $crons, string $hook): bool#

Whether any instance of the hook is in the cron table.

privateeventArgs(array $assocArgs): array#

The event arguments passed as flags, the reference's own flags removed.

@return array<string, string>
privateduration(int $seconds): string#

A number of seconds as the reference prints a recurrence: the two largest whole units, or "now".

privaterelative(int $seconds): string#

The relative run time as the reference prints it: a duration ahead, or "now" once it is due.