Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/woocomme.../includes/queue
File: class-wc-action-queue.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Action Queue
[2] Fix | Delete
*
[3] Fix | Delete
* @version 3.5.0
[4] Fix | Delete
* @package WooCommerce\Interface
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[8] Fix | Delete
exit; // Exit if accessed directly.
[9] Fix | Delete
}
[10] Fix | Delete
[11] Fix | Delete
/**
[12] Fix | Delete
* WC Action Queue
[13] Fix | Delete
*
[14] Fix | Delete
* A job queue using WordPress actions.
[15] Fix | Delete
*
[16] Fix | Delete
* @version 3.5.0
[17] Fix | Delete
*/
[18] Fix | Delete
class WC_Action_Queue implements WC_Queue_Interface {
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Enqueue an action to run one time, as soon as possible
[22] Fix | Delete
*
[23] Fix | Delete
* @param string $hook The hook to trigger.
[24] Fix | Delete
* @param array $args Arguments to pass when the hook triggers.
[25] Fix | Delete
* @param string $group The group to assign this job to.
[26] Fix | Delete
* @return string The action ID.
[27] Fix | Delete
*/
[28] Fix | Delete
public function add( $hook, $args = array(), $group = '' ) {
[29] Fix | Delete
return $this->schedule_single( time(), $hook, $args, $group );
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* Schedule an action to run once at some time in the future
[34] Fix | Delete
*
[35] Fix | Delete
* @param int $timestamp When the job will run.
[36] Fix | Delete
* @param string $hook The hook to trigger.
[37] Fix | Delete
* @param array $args Arguments to pass when the hook triggers.
[38] Fix | Delete
* @param string $group The group to assign this job to.
[39] Fix | Delete
* @return string The action ID.
[40] Fix | Delete
*/
[41] Fix | Delete
public function schedule_single( $timestamp, $hook, $args = array(), $group = '' ) {
[42] Fix | Delete
return as_schedule_single_action( $timestamp, $hook, $args, $group );
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* Schedule a recurring action
[47] Fix | Delete
*
[48] Fix | Delete
* @param int $timestamp When the first instance of the job will run.
[49] Fix | Delete
* @param int $interval_in_seconds How long to wait between runs.
[50] Fix | Delete
* @param string $hook The hook to trigger.
[51] Fix | Delete
* @param array $args Arguments to pass when the hook triggers.
[52] Fix | Delete
* @param string $group The group to assign this job to.
[53] Fix | Delete
* @return string The action ID.
[54] Fix | Delete
*/
[55] Fix | Delete
public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) {
[56] Fix | Delete
return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group );
[57] Fix | Delete
}
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Schedule an action that recurs on a cron-like schedule.
[61] Fix | Delete
*
[62] Fix | Delete
* @param int $timestamp The schedule will start on or after this time.
[63] Fix | Delete
* @param string $cron_schedule A cron-link schedule string.
[64] Fix | Delete
* @see http://en.wikipedia.org/wiki/Cron
[65] Fix | Delete
* * * * * * *
[66] Fix | Delete
* ┬ ┬ ┬ ┬ ┬ ┬
[67] Fix | Delete
* | | | | | |
[68] Fix | Delete
* | | | | | + year [optional]
[69] Fix | Delete
* | | | | +----- day of week (0 - 7) (Sunday=0 or 7)
[70] Fix | Delete
* | | | +---------- month (1 - 12)
[71] Fix | Delete
* | | +--------------- day of month (1 - 31)
[72] Fix | Delete
* | +-------------------- hour (0 - 23)
[73] Fix | Delete
* +------------------------- min (0 - 59)
[74] Fix | Delete
* @param string $hook The hook to trigger.
[75] Fix | Delete
* @param array $args Arguments to pass when the hook triggers.
[76] Fix | Delete
* @param string $group The group to assign this job to.
[77] Fix | Delete
* @return string The action ID
[78] Fix | Delete
*/
[79] Fix | Delete
public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' ) {
[80] Fix | Delete
return as_schedule_cron_action( $timestamp, $cron_schedule, $hook, $args, $group );
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
/**
[84] Fix | Delete
* Dequeue the next scheduled instance of an action with a matching hook (and optionally matching args and group).
[85] Fix | Delete
*
[86] Fix | Delete
* Any recurring actions with a matching hook should also be cancelled, not just the next scheduled action.
[87] Fix | Delete
*
[88] Fix | Delete
* While technically only the next instance of a recurring or cron action is unscheduled by this method, that will also
[89] Fix | Delete
* prevent all future instances of that recurring or cron action from being run. Recurring and cron actions are scheduled
[90] Fix | Delete
* in a sequence instead of all being scheduled at once. Each successive occurrence of a recurring action is scheduled
[91] Fix | Delete
* only after the former action is run. As the next instance is never run, because it's unscheduled by this function,
[92] Fix | Delete
* then the following instance will never be scheduled (or exist), which is effectively the same as being unscheduled
[93] Fix | Delete
* by this method also.
[94] Fix | Delete
*
[95] Fix | Delete
* @param string $hook The hook that the job will trigger.
[96] Fix | Delete
* @param array $args Args that would have been passed to the job.
[97] Fix | Delete
* @param string $group The group the job is assigned to (if any).
[98] Fix | Delete
*/
[99] Fix | Delete
public function cancel( $hook, $args = array(), $group = '' ) {
[100] Fix | Delete
as_unschedule_action( $hook, $args, $group );
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Dequeue all actions with a matching hook (and optionally matching args and group) so no matching actions are ever run.
[105] Fix | Delete
*
[106] Fix | Delete
* @param string $hook The hook that the job will trigger.
[107] Fix | Delete
* @param array $args Args that would have been passed to the job.
[108] Fix | Delete
* @param string $group The group the job is assigned to (if any).
[109] Fix | Delete
*/
[110] Fix | Delete
public function cancel_all( $hook, $args = array(), $group = '' ) {
[111] Fix | Delete
as_unschedule_all_actions( $hook, $args, $group );
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
/**
[115] Fix | Delete
* Get the date and time for the next scheduled occurrence of an action with a given hook
[116] Fix | Delete
* (an optionally that matches certain args and group), if any.
[117] Fix | Delete
*
[118] Fix | Delete
* @param string $hook The hook that the job will trigger.
[119] Fix | Delete
* @param array $args Filter to a hook with matching args that will be passed to the job when it runs.
[120] Fix | Delete
* @param string $group Filter to only actions assigned to a specific group.
[121] Fix | Delete
* @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.
[122] Fix | Delete
*/
[123] Fix | Delete
public function get_next( $hook, $args = null, $group = '' ) {
[124] Fix | Delete
[125] Fix | Delete
$next_timestamp = as_next_scheduled_action( $hook, $args, $group );
[126] Fix | Delete
[127] Fix | Delete
if ( is_numeric( $next_timestamp ) ) {
[128] Fix | Delete
return new WC_DateTime( "@{$next_timestamp}", new DateTimeZone( 'UTC' ) );
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
return null;
[132] Fix | Delete
}
[133] Fix | Delete
[134] Fix | Delete
/**
[135] Fix | Delete
* Find scheduled actions
[136] Fix | Delete
*
[137] Fix | Delete
* @param array $args Possible arguments, with their default values:
[138] Fix | Delete
* 'hook' => '' - the name of the action that will be triggered
[139] Fix | Delete
* 'args' => null - the args array that will be passed with the action
[140] Fix | Delete
* '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.
[141] Fix | Delete
* 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '='
[142] Fix | Delete
* '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.
[143] Fix | Delete
* 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '='
[144] Fix | Delete
* 'group' => '' - the group the action belongs to
[145] Fix | Delete
* 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING
[146] Fix | Delete
* 'claimed' => null - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID
[147] Fix | Delete
* 'per_page' => 5 - Number of results to return
[148] Fix | Delete
* 'offset' => 0
[149] Fix | Delete
* 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date'
[150] Fix | Delete
* 'order' => 'ASC'.
[151] Fix | Delete
*
[152] Fix | Delete
* @param string $return_format OBJECT, ARRAY_A, or ids.
[153] Fix | Delete
* @return array
[154] Fix | Delete
*/
[155] Fix | Delete
public function search( $args = array(), $return_format = OBJECT ) {
[156] Fix | Delete
return as_get_scheduled_actions( $args, $return_format );
[157] Fix | Delete
}
[158] Fix | Delete
}
[159] Fix | Delete
[160] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function