/wp-content/plugins/woocommerce/includes/interfaces/class-wc-queue-interface.php

https://gitlab.com/campus-academy/krowkaramel · PHP · 125 lines · 11 code · 9 blank · 105 comment · 0 complexity · e4f3862d4b4d3a8e31f480f2df8cbad1 MD5 · raw file

  1. <?php
  2. /**
  3. * Queue Interface
  4. *
  5. * @version 3.5.0
  6. * @package WooCommerce\Interface
  7. */
  8. /**
  9. * WC Queue Interface
  10. *
  11. * Functions that must be defined to implement an action/job/event queue.
  12. *
  13. * @version 3.5.0
  14. */
  15. interface WC_Queue_Interface {
  16. /**
  17. * Enqueue an action to run one time, as soon as possible
  18. *
  19. * @param string $hook The hook to trigger.
  20. * @param array $args Arguments to pass when the hook triggers.
  21. * @param string $group The group to assign this job to.
  22. * @return string The action ID
  23. */
  24. public function add( $hook, $args = array(), $group = '' );
  25. /**
  26. * Schedule an action to run once at some time in the future
  27. *
  28. * @param int $timestamp When the job will run.
  29. * @param string $hook The hook to trigger.
  30. * @param array $args Arguments to pass when the hook triggers.
  31. * @param string $group The group to assign this job to.
  32. * @return string The action ID
  33. */
  34. public function schedule_single( $timestamp, $hook, $args = array(), $group = '' );
  35. /**
  36. * Schedule a recurring action
  37. *
  38. * @param int $timestamp When the first instance of the job will run.
  39. * @param int $interval_in_seconds How long to wait between runs.
  40. * @param string $hook The hook to trigger.
  41. * @param array $args Arguments to pass when the hook triggers.
  42. * @param string $group The group to assign this job to.
  43. * @return string The action ID
  44. */
  45. public function schedule_recurring( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' );
  46. /**
  47. * Schedule an action that recurs on a cron-like schedule.
  48. *
  49. * @param int $timestamp The schedule will start on or after this time.
  50. * @param string $cron_schedule A cron-link schedule string.
  51. * @see http://en.wikipedia.org/wiki/Cron
  52. * * * * * * *
  53. * ┬ ┬ ┬ ┬ ┬ ┬
  54. * | | | | | |
  55. * | | | | | + year [optional]
  56. * | | | | +----- day of week (0 - 7) (Sunday=0 or 7)
  57. * | | | +---------- month (1 - 12)
  58. * | | +--------------- day of month (1 - 31)
  59. * | +-------------------- hour (0 - 23)
  60. * +------------------------- min (0 - 59)
  61. * @param string $hook The hook to trigger.
  62. * @param array $args Arguments to pass when the hook triggers.
  63. * @param string $group The group to assign this job to.
  64. * @return string The action ID
  65. */
  66. public function schedule_cron( $timestamp, $cron_schedule, $hook, $args = array(), $group = '' );
  67. /**
  68. * Dequeue the next scheduled instance of an action with a matching hook (and optionally matching args and group).
  69. *
  70. * Any recurring actions with a matching hook should also be cancelled, not just the next scheduled action.
  71. *
  72. * @param string $hook The hook that the job will trigger.
  73. * @param array $args Args that would have been passed to the job.
  74. * @param string $group The group the job is assigned to (if any).
  75. */
  76. public function cancel( $hook, $args = array(), $group = '' );
  77. /**
  78. * Dequeue all actions with a matching hook (and optionally matching args and group) so no matching actions are ever run.
  79. *
  80. * @param string $hook The hook that the job will trigger.
  81. * @param array $args Args that would have been passed to the job.
  82. * @param string $group The group the job is assigned to (if any).
  83. */
  84. public function cancel_all( $hook, $args = array(), $group = '' );
  85. /**
  86. * Get the date and time for the next scheduled occurence of an action with a given hook
  87. * (an optionally that matches certain args and group), if any.
  88. *
  89. * @param string $hook The hook that the job will trigger.
  90. * @param array $args Filter to a hook with matching args that will be passed to the job when it runs.
  91. * @param string $group Filter to only actions assigned to a specific group.
  92. * @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
  93. */
  94. public function get_next( $hook, $args = null, $group = '' );
  95. /**
  96. * Find scheduled actions.
  97. *
  98. * @param array $args Possible arguments, with their default values.
  99. * 'hook' => '' - the name of the action that will be triggered.
  100. * 'args' => null - the args array that will be passed with the action.
  101. * '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.
  102. * 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '='.
  103. * '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.
  104. * 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '='.
  105. * 'group' => '' - the group the action belongs to.
  106. * 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING.
  107. * 'claimed' => null - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID.
  108. * 'per_page' => 5 - Number of results to return.
  109. * 'offset' => 0.
  110. * 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date'.
  111. * 'order' => 'ASC'.
  112. * @param string $return_format OBJECT, ARRAY_A, or ids.
  113. * @return array
  114. */
  115. public function search( $args = array(), $return_format = OBJECT );
  116. }