PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / vendor / woocommerce / action-scheduler / classes / migration / BatchFetcher.php
jetformbuilder / vendor / woocommerce / action-scheduler / classes / migration Last commit date
ActionMigrator.php 1 year ago ActionScheduler_DBStoreMigrator.php 1 year ago BatchFetcher.php 1 year ago Config.php 1 year ago Controller.php 1 year ago DryRun_ActionMigrator.php 1 year ago DryRun_LogMigrator.php 1 year ago LogMigrator.php 1 year ago Runner.php 1 year ago Scheduler.php 1 year ago
BatchFetcher.php
96 lines
1 <?php
2
3 namespace Action_Scheduler\Migration;
4
5 use ActionScheduler_Store as Store;
6
7 /**
8 * Class BatchFetcher
9 *
10 * @package Action_Scheduler\Migration
11 *
12 * @since 3.0.0
13 *
14 * @codeCoverageIgnore
15 */
16 class BatchFetcher {
17 /**
18 * Store instance.
19 *
20 * @var ActionScheduler_Store
21 */
22 private $store;
23
24 /**
25 * BatchFetcher constructor.
26 *
27 * @param ActionScheduler_Store $source_store Source store object.
28 */
29 public function __construct( Store $source_store ) {
30 $this->store = $source_store;
31 }
32
33 /**
34 * Retrieve a list of actions.
35 *
36 * @param int $count The number of actions to retrieve.
37 *
38 * @return int[] A list of action IDs
39 */
40 public function fetch( $count = 10 ) {
41 foreach ( $this->get_query_strategies( $count ) as $query ) {
42 $action_ids = $this->store->query_actions( $query );
43 if ( ! empty( $action_ids ) ) {
44 return $action_ids;
45 }
46 }
47
48 return array();
49 }
50
51 /**
52 * Generate a list of prioritized of action search parameters.
53 *
54 * @param int $count Number of actions to find.
55 *
56 * @return array
57 */
58 private function get_query_strategies( $count ) {
59 $now = as_get_datetime_object();
60 $args = array(
61 'date' => $now,
62 'per_page' => $count,
63 'offset' => 0,
64 'orderby' => 'date',
65 'order' => 'ASC',
66 );
67
68 $priorities = array(
69 Store::STATUS_PENDING,
70 Store::STATUS_FAILED,
71 Store::STATUS_CANCELED,
72 Store::STATUS_COMPLETE,
73 Store::STATUS_RUNNING,
74 '', // any other unanticipated status.
75 );
76
77 foreach ( $priorities as $status ) {
78 yield wp_parse_args(
79 array(
80 'status' => $status,
81 'date_compare' => '<=',
82 ),
83 $args
84 );
85
86 yield wp_parse_args(
87 array(
88 'status' => $status,
89 'date_compare' => '>=',
90 ),
91 $args
92 );
93 }
94 }
95 }
96