PluginProbe ʕ •ᴥ•ʔ
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin / 3.0.3
WP Mail SMTP by WPForms – The Most Popular SMTP and Email Log Plugin v3.0.3
4.9.0 0.9.6 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.6.0 1.6.2 1.7.0 1.7.1 1.8.0 1.8.1 1.9.0 2.0.0 2.0.1 2.1.1 2.2.1 2.3.1 2.4.0 2.5.0 2.5.1 2.6.0 2.7.0 2.8.0 2.9.0 3.0.1 3.0.2 3.0.3 3.1.0 3.10.0 3.11.0 3.11.1 3.2.0 3.2.1 3.3.0 3.4.0 3.5.0 3.5.1 3.5.2 3.6.1 3.7.0 3.8.0 3.8.2 3.9.0 4.0.1 4.1.0 4.1.1 4.2.0 4.3.0 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.8.0 trunk 0.10.0 0.10.1 0.11.1 0.11.2 0.3.1 0.3.2 0.4 0.4.1 0.4.2 0.5.0 0.5.1 0.5.2 0.6 0.7 0.8 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / migration / BatchFetcher.php
wp-mail-smtp / vendor / woocommerce / action-scheduler / classes / migration Last commit date
ActionMigrator.php 4 years ago ActionScheduler_DBStoreMigrator.php 4 years ago BatchFetcher.php 4 years ago Config.php 4 years ago Controller.php 4 years ago DryRun_ActionMigrator.php 4 years ago DryRun_LogMigrator.php 4 years ago LogMigrator.php 4 years ago Runner.php 4 years ago Scheduler.php 4 years ago
BatchFetcher.php
86 lines
1 <?php
2
3
4 namespace Action_Scheduler\Migration;
5
6
7 use ActionScheduler_Store as Store;
8
9 /**
10 * Class BatchFetcher
11 *
12 * @package Action_Scheduler\Migration
13 *
14 * @since 3.0.0
15 *
16 * @codeCoverageIgnore
17 */
18 class BatchFetcher {
19 /** var ActionScheduler_Store */
20 private $store;
21
22 /**
23 * BatchFetcher constructor.
24 *
25 * @param ActionScheduler_Store $source_store Source store object.
26 */
27 public function __construct( Store $source_store ) {
28 $this->store = $source_store;
29 }
30
31 /**
32 * Retrieve a list of actions.
33 *
34 * @param int $count The number of actions to retrieve
35 *
36 * @return int[] A list of action IDs
37 */
38 public function fetch( $count = 10 ) {
39 foreach ( $this->get_query_strategies( $count ) as $query ) {
40 $action_ids = $this->store->query_actions( $query );
41 if ( ! empty( $action_ids ) ) {
42 return $action_ids;
43 }
44 }
45
46 return [];
47 }
48
49 /**
50 * Generate a list of prioritized of action search parameters.
51 *
52 * @param int $count Number of actions to find.
53 *
54 * @return array
55 */
56 private function get_query_strategies( $count ) {
57 $now = as_get_datetime_object();
58 $args = [
59 'date' => $now,
60 'per_page' => $count,
61 'offset' => 0,
62 'orderby' => 'date',
63 'order' => 'ASC',
64 ];
65
66 $priorities = [
67 Store::STATUS_PENDING,
68 Store::STATUS_FAILED,
69 Store::STATUS_CANCELED,
70 Store::STATUS_COMPLETE,
71 Store::STATUS_RUNNING,
72 '', // any other unanticipated status
73 ];
74
75 foreach ( $priorities as $status ) {
76 yield wp_parse_args( [
77 'status' => $status,
78 'date_compare' => '<=',
79 ], $args );
80 yield wp_parse_args( [
81 'status' => $status,
82 'date_compare' => '>=',
83 ], $args );
84 }
85 }
86 }