1 | <?php |
||
16 | class Object_Sync_Sf_Queue { |
||
17 | |||
18 | protected $wpdb; |
||
19 | protected $version; |
||
20 | protected $slug; |
||
21 | protected $option_prefix; |
||
22 | protected $schedulable_classes; |
||
23 | |||
24 | public function __construct( $wpdb, $version, $slug, $option_prefix, $schedulable_classes ) { |
||
33 | |||
34 | /** |
||
35 | * Add actions |
||
36 | * |
||
37 | */ |
||
38 | private function add_actions() { |
||
42 | |||
43 | /** |
||
44 | * Set the batch size. |
||
45 | * |
||
46 | * @param int $batch_size |
||
47 | * @return int $batch_size |
||
48 | */ |
||
49 | public function action_scheduler_batch_size( $batch_size ) { |
||
54 | |||
55 | /** |
||
56 | * Set the number of concurrent batches that can run. |
||
57 | * |
||
58 | * @param int $concurrent_batches |
||
59 | * @return int $concurrent_batches |
||
60 | */ |
||
61 | public function action_scheduler_concurrent_batches( $concurrent_batches ) { |
||
66 | |||
67 | /** |
||
68 | * Get all the schedules with their frequencies, sorted |
||
69 | * |
||
70 | * @param string $unit The unit of time |
||
71 | * @param string $sort Which direction to sort |
||
72 | * @return array $this->schedulable_classes |
||
73 | */ |
||
74 | public function get_frequencies( $unit = 'seconds', $sort = 'asc' ) { |
||
100 | |||
101 | /** |
||
102 | * Get a single schedule item's frequency |
||
103 | * |
||
104 | * @param string $name The name of the schedule |
||
105 | * @param string $unit The unit of time |
||
106 | * @return int How often it runs in that unit of time |
||
107 | */ |
||
108 | public function get_frequency( $name, $unit ) { |
||
134 | |||
135 | /** |
||
136 | * Enqueue an action to run one time, as soon as possible |
||
137 | * |
||
138 | * @param string $hook The hook to trigger. |
||
139 | * @param array $args Arguments to pass when the hook triggers. |
||
140 | * @param string $group The group to assign this job to. |
||
141 | * @return string The action ID. |
||
142 | */ |
||
143 | public function add( $hook, $args = array(), $group = '' ) { |
||
146 | |||
147 | /** |
||
148 | * Schedule an action to run once at some time in the future |
||
149 | * |
||
150 | * @param int $timestamp When the job will run. |
||
151 | * @param string $hook The hook to trigger. |
||
152 | * @param array $args Arguments to pass when the hook triggers. |
||
153 | * @param string $group The group to assign this job to. |
||
154 | * @return string The action ID. |
||
155 | */ |
||
156 | public function schedule_single( $timestamp, $hook, $args = array(), $group = '' ) { |
||
159 | |||
160 | /** |
||
161 | * Schedule a recurring action |
||
162 | * |
||
163 | * @param int $timestamp When the first instance of the job will run. |
||
164 | * @param int $interval_in_seconds How long to wait between runs. |
||
165 | * @param string $hook The hook to trigger. |
||
166 | * @param array $args Arguments to pass when the hook triggers. |
||
167 | * @param string $group The group to assign this job to. |
||
168 | * @return string The action ID. |
||
169 | */ |
||
170 | public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
||
173 | |||
174 | /** |
||
175 | * Schedule an action that recurs on a cron-like schedule. |
||
176 | * |
||
177 | * @param int $timestamp The schedule will start on or after this time. |
||
178 | * @param string $cron_schedule A cron-link schedule string. |
||
179 | * @see http://en.wikipedia.org/wiki/Cron |
||
180 | * * * * * * * |
||
181 | * ┬ ┬ ┬ ┬ ┬ ┬ |
||
182 | * | | | | | | |
||
183 | * | | | | | + year [optional] |
||
184 | * | | | | +----- day of week (0 - 7) (Sunday=0 or 7) |
||
185 | * | | | +---------- month (1 - 12) |
||
186 | * | | +--------------- day of month (1 - 31) |
||
187 | * | +-------------------- hour (0 - 23) |
||
188 | * +------------------------- min (0 - 59) |
||
189 | * @param string $hook The hook to trigger. |
||
190 | * @param array $args Arguments to pass when the hook triggers. |
||
191 | * @param string $group The group to assign this job to. |
||
192 | * @return string The action ID |
||
193 | */ |
||
194 | public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' ) { |
||
197 | |||
198 | /** |
||
199 | * Dequeue all actions with a matching hook (and optionally matching args and group) so they are not run. |
||
200 | * |
||
201 | * Any recurring actions with a matching hook will also be cancelled, not just the next scheduled action. |
||
202 | * |
||
203 | * Technically, one action in a recurring or Cron action is scheduled at any one point in time. The next |
||
204 | * in the sequence is scheduled after the previous one is run, so only the next scheduled action needs to |
||
205 | * be cancelled/dequeued to stop the sequence. |
||
206 | * |
||
207 | * @param string $hook The hook that the job will trigger. |
||
208 | * @param array $args Args that would have been passed to the job. |
||
209 | * @param string $group Group name. |
||
210 | */ |
||
211 | public function cancel( $hook, $args = array(), $group = '' ) { |
||
214 | |||
215 | /** |
||
216 | * Get the date and time for the next scheduled occurence of an action with a given hook |
||
217 | * (an optionally that matches certain args and group), if any. |
||
218 | * |
||
219 | * @param string $hook Hook name. |
||
220 | * @param array $args Arguments. |
||
221 | * @param string $group Group name. |
||
222 | * @return time|null The date and time for the next occurrence, or null if there is no pending, scheduled action for the given hook. |
||
223 | */ |
||
224 | public function get_next( $hook, $args = null, $group = '' ) { |
||
234 | |||
235 | /** |
||
236 | * Find scheduled actions |
||
237 | * |
||
238 | * @param array $args Possible arguments, with their default values: |
||
239 | * 'hook' => '' - the name of the action that will be triggered |
||
240 | * 'args' => null - the args array that will be passed with the action |
||
241 | * 'date' => null - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. |
||
242 | * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' |
||
243 | * 'modified' => null - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone. |
||
244 | * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' |
||
245 | * 'group' => '' - the group the action belongs to |
||
246 | * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING |
||
247 | * 'claimed' => null - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID |
||
248 | * 'per_page' => 5 - Number of results to return |
||
249 | * 'offset' => 0 |
||
250 | * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' |
||
251 | * 'order' => 'ASC'. |
||
252 | * |
||
253 | * @param string $return_format OBJECT, ARRAY_A, or ids. |
||
254 | * @return array |
||
255 | */ |
||
256 | public function search( $args = array(), $return_format = OBJECT ) { |
||
259 | } |
||
260 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.