/** * Handle queue ajax requests */ public function ajax() { $this->record_id = (int) $_POST['record']; // Nonce check $this->ajax_operations->verify_or_exit($_POST['check'], $this->get_ajax_nonce_action(), $this->get_unable_to_continue_processing_data()); // Load the queue $queue = $this->queue ? $this->queue : new Tribe__Events__Aggregator__Record__Queue($this->record_id); if (!$queue->is_empty()) { $this->queue_processor->set_current_queue($queue); $this->queue_processor->process_batch($this->record_id); } $done = $this->queue_processor->current_queue->is_empty(); $percentage = $this->queue_processor->current_queue->progress_percentage(); $this->ajax_operations->exit_data($this->get_progress_message_data($this->queue_processor->current_queue, $percentage, $done)); }
/** * Processes the next waiting batch of Import Record posts, if there are any. * * @param int $batch_size */ public function process_queue($batch_size = null) { if (null === $batch_size) { /** * Controls the size of each batch processed by default (ie, during cron updates of record * inserts/updates). * * @param int $default_batch_size */ self::$batch_size = (int) apply_filters('tribe_aggregator_batch_size', self::$batch_size); } else { self::$batch_size = (int) $batch_size; } while ($this->next_waiting_record()) { if (!$this->do_processing()) { break; } } }