ActionSchedulerDriver
in package
implements
JobSchedulerInterface
Action Scheduler job driver — the preferred backend when present.
Action Scheduler (bundled with WooCommerce, also shippable standalone) gives a persistent claimed queue with retries, an admin UI under Tools → Scheduled Actions and a WP-CLI runner. Jobs are enqueued as async actions (run on the next queue pass, no timestamp) under an optional group so a host with several MIDDAG plugins can tell their queues apart.
The driver degrades to a refused enqueue (false) when the Action Scheduler API is absent at call time; use JobScheduler::make() to fall back to WpCronDriver instead of ever hitting that path.
Table of Contents
Interfaces
- JobSchedulerInterface
- Contract for enqueuing one-off async jobs on a WordPress host.
Properties
- $group : string
Methods
- __construct() : mixed
- enqueue() : bool
- Enqueue a one-off job for as-soon-as-possible async execution.
- isAvailable() : bool
Properties
$group
private
string
$group
= ''
Methods
__construct()
public
__construct([string $group = '' ]) : mixed
Parameters
- $group : string = ''
-
Action Scheduler group tag (e.g. the plugin slug)
enqueue()
Enqueue a one-off job for as-soon-as-possible async execution.
public
enqueue(string $hook[, array<string|int, mixed> $args = [] ]) : bool
Parameters
- $hook : string
-
the action hook the job fires
- $args : array<string|int, mixed> = []
-
positional arguments passed to the hook listener; must be distinct per job under WP-Cron (identical hook+args pairs within ten minutes are suppressed)
Return values
bool —true when the job was accepted by the backend
isAvailable()
public
static isAvailable() : bool