Tribe__Events__Aggregator__Record__Abstract::process_posts( array $data = array(), bool $start_immediately = false )
Queues events, venues, and organizers for insertion
Contents
Parameters
- $data
-
(array) (Optional) Import data.
Default value: array()
- $start_immediately
-
(bool) (Optional) Whether the data processing should start immediately or not.
Default value: false
Return
(array|Tribe__Events__Aggregator__Record__Queue_Interface|WP_Error|Tribe__Events__Aggregator__Record__Activity)
Source
File: src/Tribe/Aggregator/Record/Abstract.php
public function process_posts( $data = array(), $start_immediately = false ) {
if ( ! $start_immediately && 'manual' === $this->type ) {
/** @var Tribe__Events__Aggregator__Service $service */
$service = tribe( 'events-aggregator.service' );
$service->confirm_import( $this->meta );
}
// if this is a batch push record then set its queue to fetching
// to feed the UI something coherent
if ( ! $start_immediately && ! $this->is_polling() ) {
// @todo let's revisit this to return when more UI is exposed
$queue = new Tribe__Events__Aggregator__Record__Queue( $this, 'fetch' );
return $queue;
}
$items = $this->prep_import_data( $data );
if ( is_wp_error( $items ) ) {
return $items;
}
$queue = Tribe__Events__Aggregator__Record__Queue_Processor::build_queue( $this, $items );
if ( $start_immediately && is_array( $items ) ) {
$queue->process();
}
return $queue->activity();
}