Fix PHPCS errors on WC_Action_Queue and make sure to pass on correct variable in schedule_cront function.
This commit is contained in:
parent
883a5f90eb
commit
19401ea7d0
|
@ -1,4 +1,3 @@
|
|||
|
||||
<?php
|
||||
/**
|
||||
* Action Queue
|
||||
|
@ -23,10 +22,10 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
/**
|
||||
* Enqueue an action to run one time, as soon as possible
|
||||
*
|
||||
* @param string $hook The hook to trigger
|
||||
* @param array $args Arguments to pass when the hook triggers
|
||||
* @param string $group The group to assign this job to
|
||||
* @return string The action ID
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @return string The action ID.
|
||||
*/
|
||||
public function add( $hook, $args = array(), $group = '' ) {
|
||||
return $this->schedule_single( time(), $hook, $args, $group );
|
||||
|
@ -35,11 +34,11 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
/**
|
||||
* Schedule an action to run once at some time in the future
|
||||
*
|
||||
* @param int $timestamp When the job will run
|
||||
* @param string $hook The hook to trigger
|
||||
* @param array $args Arguments to pass when the hook triggers
|
||||
* @param string $group The group to assign this job to
|
||||
* @return string The action ID
|
||||
* @param int $timestamp When the job will run.
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @return string The action ID.
|
||||
*/
|
||||
public function schedule_single( $timestamp, $hook, $args = array(), $group = '' ) {
|
||||
return wc_schedule_single_action( $timestamp, $hook, $args, $group );
|
||||
|
@ -48,12 +47,12 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
/**
|
||||
* Schedule a recurring action
|
||||
*
|
||||
* @param int $timestamp When the first instance of the job will run
|
||||
* @param int $interval_in_seconds How long to wait between runs
|
||||
* @param string $hook The hook to trigger
|
||||
* @param array $args Arguments to pass when the hook triggers
|
||||
* @param string $group The group to assign this job to
|
||||
* @return string The action ID
|
||||
* @param int $timestamp When the first instance of the job will run.
|
||||
* @param int $interval_in_seconds How long to wait between runs.
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @return string The action ID.
|
||||
*/
|
||||
public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) {
|
||||
return wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group );
|
||||
|
@ -62,8 +61,8 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
/**
|
||||
* Schedule an action that recurs on a cron-like schedule.
|
||||
*
|
||||
* @param int $timestamp The schedule will start on or after this time
|
||||
* @param string $cron_schedule A cron-link schedule string
|
||||
* @param int $timestamp The schedule will start on or after this time.
|
||||
* @param string $cron_schedule A cron-link schedule string.
|
||||
* @see http://en.wikipedia.org/wiki/Cron
|
||||
* * * * * * *
|
||||
* ┬ ┬ ┬ ┬ ┬ ┬
|
||||
|
@ -74,13 +73,13 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
* | | +--------------- day of month (1 - 31)
|
||||
* | +-------------------- hour (0 - 23)
|
||||
* +------------------------- min (0 - 59)
|
||||
* @param string $hook The hook to trigger
|
||||
* @param array $args Arguments to pass when the hook triggers
|
||||
* @param string $group The group to assign this job to
|
||||
* @param string $hook The hook to trigger.
|
||||
* @param array $args Arguments to pass when the hook triggers.
|
||||
* @param string $group The group to assign this job to.
|
||||
* @return string The action ID
|
||||
*/
|
||||
public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' ) {
|
||||
return wc_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group );
|
||||
return wc_schedule_cron_action( $timestamp, $cron_schedule, $hook, $args, $group );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,9 +91,9 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
* in the sequence is scheduled after the previous one is run, so only the next scheduled action needs to
|
||||
* be cancelled/dequeued to stop the sequence.
|
||||
*
|
||||
* @param string $hook The hook that the job will trigger
|
||||
* @param array $args Args that would have been passed to the job
|
||||
* @param string $group
|
||||
* @param string $hook The hook that the job will trigger.
|
||||
* @param array $args Args that would have been passed to the job.
|
||||
* @param string $group Group name.
|
||||
*/
|
||||
public function cancel( $hook, $args = array(), $group = '' ) {
|
||||
wc_unschedule_action( $hook, $args, $group );
|
||||
|
@ -104,11 +103,10 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
* Get the date and time for the next scheduled occurence of an action with a given hook
|
||||
* (an optionally that matches certain args and group), if any.
|
||||
*
|
||||
* @param string $hook
|
||||
* @param array $args
|
||||
* @param string $group
|
||||
* @return int|bool The timestamp for the next occurrence, or false if nothing was found
|
||||
* @return WC_DateTime|null The date and time for the next occurrence, or null if there is no pending, scheduled action for the given hook
|
||||
* @param string $hook Hook name.
|
||||
* @param array $args Arguments.
|
||||
* @param string $group Group name.
|
||||
* @return WC_DateTime|null The date and time for the next occurrence, or null if there is no pending, scheduled action for the given hook.
|
||||
*/
|
||||
public function get_next( $hook, $args = null, $group = '' ) {
|
||||
|
||||
|
@ -124,7 +122,7 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
/**
|
||||
* Find scheduled actions
|
||||
*
|
||||
* @param array $args Possible arguments, with their default values:
|
||||
* @param array $args Possible arguments, with their default values:
|
||||
* 'hook' => '' - the name of the action that will be triggered
|
||||
* 'args' => null - the args array that will be passed with the action
|
||||
* '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.
|
||||
|
@ -137,10 +135,9 @@ class WC_Action_Queue implements WC_Queue_Interface {
|
|||
* 'per_page' => 5 - Number of results to return
|
||||
* 'offset' => 0
|
||||
* 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date'
|
||||
* 'order' => 'ASC'
|
||||
*
|
||||
* @param string $return_format OBJECT, ARRAY_A, or ids
|
||||
* 'order' => 'ASC'.
|
||||
*
|
||||
* @param string $return_format OBJECT, ARRAY_A, or ids.
|
||||
* @return array
|
||||
*/
|
||||
public function search( $args = array(), $return_format = OBJECT ) {
|
||||
|
|
Loading…
Reference in New Issue