Server IP : 172.67.158.161 / Your IP : 3.142.135.34 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/dangky.bnnagency.com/wp-content/plugins/wp-mail-smtp/vendor/woocommerce/action-scheduler/classes/migration/ |
Upload File : |
<?php namespace Action_Scheduler\Migration; use ActionScheduler_Store as Store; /** * Class BatchFetcher * * @package Action_Scheduler\Migration * * @since 3.0.0 * * @codeCoverageIgnore */ class BatchFetcher { /** var ActionScheduler_Store */ private $store; /** * BatchFetcher constructor. * * @param ActionScheduler_Store $source_store Source store object. */ public function __construct( Store $source_store ) { $this->store = $source_store; } /** * Retrieve a list of actions. * * @param int $count The number of actions to retrieve * * @return int[] A list of action IDs */ public function fetch( $count = 10 ) { foreach ( $this->get_query_strategies( $count ) as $query ) { $action_ids = $this->store->query_actions( $query ); if ( ! empty( $action_ids ) ) { return $action_ids; } } return []; } /** * Generate a list of prioritized of action search parameters. * * @param int $count Number of actions to find. * * @return array */ private function get_query_strategies( $count ) { $now = as_get_datetime_object(); $args = [ 'date' => $now, 'per_page' => $count, 'offset' => 0, 'orderby' => 'date', 'order' => 'ASC', ]; $priorities = [ Store::STATUS_PENDING, Store::STATUS_FAILED, Store::STATUS_CANCELED, Store::STATUS_COMPLETE, Store::STATUS_RUNNING, '', // any other unanticipated status ]; foreach ( $priorities as $status ) { yield wp_parse_args( [ 'status' => $status, 'date_compare' => '<=', ], $args ); yield wp_parse_args( [ 'status' => $status, 'date_compare' => '>=', ], $args ); } } }