You are here

public function FeedsSource::startImport in Feeds 7.2

Start importing a source.

This method starts an import job. Depending on the configuration of the importer of this source, a Batch API job or a background job with Job Scheduler will be created.

Throws

Exception If processing in background is enabled, the first batch chunk of the import will be executed on the current page request. This means that this method may throw the same exceptions as FeedsSource::import().

File

includes/FeedsSource.inc, line 347
Definition of FeedsSourceInterface, FeedsState and FeedsSource class.

Class

FeedsSource
Holds the source of a feed to import.

Code

public function startImport() {
  $config = $this->importer
    ->getConfig();
  if ($config['process_in_background']) {
    $this
      ->startBackgroundJob('import');
  }
  else {
    $this
      ->startBatchAPIJob(t('Importing'), 'import');
  }
}