/**
  * Processes the current import record queue. May return boolean false if it is unable to continue.
  *
  * @return bool
  */
 protected function do_processing()
 {
     // Bail out if the batch limit has been exceeded, if nothing is waiting in the queue
     // or the queue is actively being processed by a concurrent request/scheduled task
     if ($this->batch_complete() || !$this->get_current_queue() || $this->current_queue->is_in_progress()) {
         return false;
     }
     $this->current_queue->set_in_progress_flag();
     $processed = $this->current_queue->process(self::$batch_size);
     $this->processed += $processed->activity->count($this->current_queue->get_queue_type());
     $this->current_queue->clear_in_progress_flag();
     return true;
 }
Example #2
0
 /**
  * Queues events, venues, and organizers for insertion
  *
  * @param array $data Import data
  *
  * @return array|WP_Error
  */
 public function process_posts($data = array())
 {
     if ('csv' !== $data['origin'] || empty($data['csv']['content_type'])) {
         return tribe_error('core:aggregator:invalid-csv-parameters');
     }
     if ($this->has_queue()) {
         $queue = new Tribe__Events__Aggregator__Record__Queue($this->post->ID);
         return $queue->process();
     }
     $importer = $this->prep_import_data($data);
     $queue = new Tribe__Events__Aggregator__Record__Queue($this->post->ID, $importer);
     return $queue->process();
 }
 /**
  * Queues events, venues, and organizers for insertion
  *
  * @param array $data Import data
  *
  * @return array|WP_Error
  */
 public function process_posts($data = array())
 {
     if ($this->has_queue()) {
         $queue = new Tribe__Events__Aggregator__Record__Queue($this);
         return $queue->process();
     }
     $items = $this->prep_import_data($data);
     if (is_wp_error($items)) {
         $this->set_status_as_failed($items);
         return $items;
     }
     $queue = new Tribe__Events__Aggregator__Record__Queue($this, $items);
     return $queue->process();
 }