WordPress.org

Make WordPress Core

Opened 11 months ago

Closed 11 months ago

Last modified 11 months ago

#45797 closed enhancement (fixed)

Add function for getting "ready" cron jobs with preflight filter for hijacking.

Reported by: peterwilsoncc Owned by: peterwilsoncc
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: Cron API Keywords: has-patch needs-dev-note
Focuses: Cc:
PR Number:

Description

Add the function wp_get_ready_cron_jobs() to return jobs ready to be run (with a timestamp in the past) with a preflight filter to allow plugins to use a custom cron storage mechanism.

This is to round out the functionality of #32656 to allow custom cron storage while making use of Core's system for spawning jobs.

Attachments (2)

45797.diff (2.5 KB) - added by peterwilsoncc 11 months ago.
45797.2.diff (2.5 KB) - added by peterwilsoncc 11 months ago.

Download all attachments as: .zip

Change History (6)

#1 @pento
11 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 5.1

This is fine to commit to finish off #32656.

#2 @peterwilsoncc
11 months ago

  • Owner set to peterwilsoncc
  • Status changed from new to assigned

45797.2.diff adds @since tags to the docblocks following Pento's code review and commit approval.

#3 @peterwilsoncc
11 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 44483:

Cron API: Add function and filter to return ready cron jobs.

Add the function wp_get_ready_cron_jobs() to return a modified version of the cron array limited to jobs ready to be run, ie with a timestamp of time() or earlier.

The new function includes the filter pre_get_ready_cron_jobs to allow for custom cron storage systems. This rounds out the functionality added in #32656.

Props Pento for code review.
Fixes #45797.

#4 @desrosj
11 months ago

  • Keywords needs-dev-note added; commit removed
Note: See TracTickets for help on using tickets.