Commit Graph

4 Commits

Author SHA1 Message Date
Brent Shepherd 32d3de3aa8 Use new as_ prefixed Action Scheduler functions 2018-09-20 15:39:56 +10:00
Gerhard Potgieter 19401ea7d0 Fix PHPCS errors on WC_Action_Queue and make sure to pass on correct variable in schedule_cront function. 2018-08-01 20:11:08 +02:00
Brent Shepherd ab78e65af9 Update WC_Queue_Interface::get_next()
To more closely align return value with other date APIs in WC, namely
WC_Data. Includes changing return value to:

1. a WC_DateTime instead of a timestamp when a scheduled occurrence is found
2. null instead of false, similar to the default of WC_Data::set_date_prop()
2018-07-31 12:29:15 +10:00
Brent Shepherd 0611ff7665 Add WC_Action_Queue
As a wrapper for Action Scheduler. This implements the WC_Queue_Interface
so it can be used as WC core's job queue. Implementing WC_Queue_Interface
also means this class has more generic and appropriate job queue nomenclature
than Action Scheduler itself. For exsample, it provides a method for
non-delayed jobs, i.e. WC_Queue_Interface::add(), unlike Action Scheduler,
which requires scheduling a job for now(), which while fairly simple, is not
intuitive or immediately obvious to new comers.

This makes it both more clear and convenient to use Action Scheduler
as a simple job queue instead of just a queue for delayed jobs.
2018-07-31 12:21:04 +10:00