public function Feed::finishImport in Feeds 8.3
Cleans up after an import.
Overrides FeedInterface::finishImport
File
- src/
Entity/ Feed.php, line 315
Class
- Feed
- Defines the feed entity class.
Namespace
Drupal\feeds\EntityCode
public function finishImport() {
$time = time();
$this
->getType()
->getProcessor()
->postProcess($this, $this
->getState(StateInterface::PROCESS));
foreach ($this->states as $state) {
if (is_object($state)) {
$state
->displayMessages();
$state
->logMessages($this);
}
}
// Allow other modules to react upon finishing importing.
$this
->eventDispatcher()
->dispatch(FeedsEvents::IMPORT_FINISHED, new ImportFinishedEvent($this));
// Cleanup.
$this
->clearStates();
$this
->setQueuedTime(0);
$this
->set('imported', $time);
$interval = $this
->getType()
->getImportPeriod();
if ($interval !== FeedTypeInterface::SCHEDULE_NEVER) {
$this
->set('next', $interval + $time);
}
$this
->save();
$this
->unlock();
}