You are here

public function FeedsSource::startClear in Feeds 8.2

Start deleting all imported items of a source.

This method starts a clear 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 clear task will be executed on the current page request. This means that this method may throw the same exceptions as FeedsSource::clear().

File

lib/Drupal/feeds/FeedsSource.php, line 147
Definition of FeedsSourceInterface and FeedsSource class.

Class

FeedsSource
This class encapsulates a source of a feed. It stores where the feed can be found and how to import it.

Namespace

Drupal\feeds

Code

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