API / Minn\Cron

Minn\Cron

Scheduled publishing. 1 classes, 4 public methods and 8 internals. This page is the public surface; each class name opens the whole class.

Cron final readonly class

public/minn/src/Minn/Cron/Cron.php · 175 lines · Open the class →

The engine's scheduled work: scheduled posts go live when their time comes, the cron option's due events fire, expired throttle rows and transients are swept, and the daily auto-update check runs. Triggered by wp-cron.php, `wp minn cron`, `minn cron`, or a front request that finds something due (after its response is sent). One run at a time, through a short-lived lock option.

Firing the cron option's due hooks needs the booted runtime and the facade, so it arrives as a closure the caller supplies (from the front pipeline, or the CLI once it has booted the runtime); with none, only the engine's own scheduled posts and sweeps run.

new__construct(Minn\Db $db, Minn\Content\Site $site, Minn\Content\PostWriter $writer, ?Minn\Ops\Updates $updates = NULL, ?Closure $fireDueEvents = NULL)
@param ?Closure(): int $fireDueEvents fires the cron option's due hooks and returns how many ran
staticcreate(Minn\Db $db, Minn\Content\Site $site, string $contentDir, ?Closure $fireDueEvents): self

The one recipe every trigger builds from: the post writer, the updater over the site's wp-content, and the runtime's firing closure.

@param ?Closure(): int $fireDueEvents
methodrun(): array

Runs every due job; the report lists what happened. @return list<string>

@return list<string>
methodidle(): bool

True when a hit has nothing to do: no job is due and the housekeeping (expired transients and throttle rows) ran within the last minute, so a request repeated as fast as a visitor can send it costs two reads.

methoddue(): bool

True when a scheduled post's time has come or the cron option holds a due event.

insidefireEvents(), applyAutoUpdates(), postDue(), publishDue(), sweepTransients(), sweepThrottle(), lock(), unlock()