[wp-trac] [WordPress Trac] #32656: Add hooks to allow hijacking cron implementation

WordPress Trac noreply at wordpress.org
Thu Mar 29 16:53:58 UTC 2018


#32656: Add hooks to allow hijacking cron implementation
-----------------------------------+----------------------------
 Reporter:  rmccue                 |       Owner:  peterwilsoncc
     Type:  feature request        |      Status:  assigned
 Priority:  normal                 |   Milestone:  5.0
Component:  Cron API               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+----------------------------

Comment (by ethitter):

 These hooks would be a great addition! Cron Control does some interesting
 things to offload event storage to its own table, and these hooks would
 significantly simplify that. Allowing plugins to completely bypass the
 `cron` option would go a long way towards eliminating race conditions that
 can occur under load.

 The issue in `wp_reschedule_event()` is an interesting one. The cron array
 is only needed if the interval can't be determined, which should only
 happen if a schedule is removed but the events that use it remain. Two
 options come to mind. The first is to introduce a
 `wp_get_scheduled_event()` or some such thing, which wraps the call to
 `_get_cron_array()` and the attendant parsing out of the event, and which
 includes a `pre_` filter for hijacking. My second thought was to update
 `wp_next_scheduled()` to be able to return more than the event's
 timestamp. A `pre_` filter in `_get_cron_array()` is something I
 considered, but it won't scale unless the function accepts arguments that
 could be used to return a subset of scheduled events; with the `pre_`
 filters in all of the functions that use the cron array, I'm inclined to
 leave the array helper alone.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32656#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list