ActionScheduler_Abstract_QueueRunner_Deprecated.php
6 years ago
ActionScheduler_AdminView_Deprecated.php
6 years ago
ActionScheduler_Schedule_Deprecated.php
6 years ago
ActionScheduler_Store_Deprecated.php
6 years ago
functions.php
6 years ago
functions.php
127 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Deprecated API functions for scheduling actions |
| 5 | * |
| 6 | * Functions with the wc prefix were deprecated to avoid confusion with |
| 7 | * Action Scheduler being included in WooCommerce core, and it providing |
| 8 | * a different set of APIs for working with the action queue. |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * Schedule an action to run one time |
| 13 | * |
| 14 | * @param int $timestamp When the job will run |
| 15 | * @param string $hook The hook to trigger |
| 16 | * @param array $args Arguments to pass when the hook triggers |
| 17 | * @param string $group The group to assign this job to |
| 18 | * |
| 19 | * @return string The job ID |
| 20 | */ |
| 21 | function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) { |
| 22 | _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' ); |
| 23 | return as_schedule_single_action( $timestamp, $hook, $args, $group ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Schedule a recurring action |
| 28 | * |
| 29 | * @param int $timestamp When the first instance of the job will run |
| 30 | * @param int $interval_in_seconds How long to wait between runs |
| 31 | * @param string $hook The hook to trigger |
| 32 | * @param array $args Arguments to pass when the hook triggers |
| 33 | * @param string $group The group to assign this job to |
| 34 | * |
| 35 | * @deprecated 2.1.0 |
| 36 | * |
| 37 | * @return string The job ID |
| 38 | */ |
| 39 | function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) { |
| 40 | _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' ); |
| 41 | return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group ); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Schedule an action that recurs on a cron-like schedule. |
| 46 | * |
| 47 | * @param int $timestamp The schedule will start on or after this time |
| 48 | * @param string $schedule A cron-link schedule string |
| 49 | * @see http://en.wikipedia.org/wiki/Cron |
| 50 | * * * * * * * |
| 51 | * ┬ ┬ ┬ ┬ ┬ ┬ |
| 52 | * | | | | | | |
| 53 | * | | | | | + year [optional] |
| 54 | * | | | | +----- day of week (0 - 7) (Sunday=0 or 7) |
| 55 | * | | | +---------- month (1 - 12) |
| 56 | * | | +--------------- day of month (1 - 31) |
| 57 | * | +-------------------- hour (0 - 23) |
| 58 | * +------------------------- min (0 - 59) |
| 59 | * @param string $hook The hook to trigger |
| 60 | * @param array $args Arguments to pass when the hook triggers |
| 61 | * @param string $group The group to assign this job to |
| 62 | * |
| 63 | * @deprecated 2.1.0 |
| 64 | * |
| 65 | * @return string The job ID |
| 66 | */ |
| 67 | function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) { |
| 68 | _deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' ); |
| 69 | return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group ); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Cancel the next occurrence of a job. |
| 74 | * |
| 75 | * @param string $hook The hook that the job will trigger |
| 76 | * @param array $args Args that would have been passed to the job |
| 77 | * @param string $group |
| 78 | * |
| 79 | * @deprecated 2.1.0 |
| 80 | */ |
| 81 | function wc_unschedule_action( $hook, $args = array(), $group = '' ) { |
| 82 | _deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' ); |
| 83 | as_unschedule_action( $hook, $args, $group ); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @param string $hook |
| 88 | * @param array $args |
| 89 | * @param string $group |
| 90 | * |
| 91 | * @deprecated 2.1.0 |
| 92 | * |
| 93 | * @return int|bool The timestamp for the next occurrence, or false if nothing was found |
| 94 | */ |
| 95 | function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) { |
| 96 | _deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' ); |
| 97 | return as_next_scheduled_action( $hook, $args, $group ); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Find scheduled actions |
| 102 | * |
| 103 | * @param array $args Possible arguments, with their default values: |
| 104 | * 'hook' => '' - the name of the action that will be triggered |
| 105 | * 'args' => NULL - the args array that will be passed with the action |
| 106 | * '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. |
| 107 | * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '=' |
| 108 | * '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. |
| 109 | * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '=' |
| 110 | * 'group' => '' - the group the action belongs to |
| 111 | * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING |
| 112 | * 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID |
| 113 | * 'per_page' => 5 - Number of results to return |
| 114 | * 'offset' => 0 |
| 115 | * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date' |
| 116 | * 'order' => 'ASC' |
| 117 | * @param string $return_format OBJECT, ARRAY_A, or ids |
| 118 | * |
| 119 | * @deprecated 2.1.0 |
| 120 | * |
| 121 | * @return array |
| 122 | */ |
| 123 | function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) { |
| 124 | _deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' ); |
| 125 | return as_get_scheduled_actions( $args, $return_format ); |
| 126 | } |
| 127 |