public function FeedsSource::clear in Feeds 8.2
Remove all items from a feed.
This method only executes the current batch chunk, then returns. If you are looking to delete all items of a source, use FeedsSource::startClear() instead.
Return value
FEEDS_BATCH_COMPLETE if the clearing process finished. A decimal between 0.0 and 0.9 periodic if clearing is still in progress.
Throws
Throws Exception if an error occurs when clearing.
File
- lib/
Drupal/ feeds/ FeedsSource.php, line 302 - 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\feedsCode
public function clear() {
$this
->acquireLock();
try {
$this->importer->fetcher
->clear($this);
$this->importer->parser
->clear($this);
$this->importer->processor
->clear($this);
} catch (Exception $e) {
// Do nothing.
}
$this
->releaseLock();
// Clean up.
$result = $this
->progressClearing();
if ($result == FEEDS_BATCH_COMPLETE || isset($e)) {
module_invoke_all('feeds_after_clear', $this);
unset($this->state);
}
$this
->save();
if (isset($e)) {
throw $e;
}
return $result;
}