public function FeedsSourceCrawler::import in Feeds Crawler 6.2
Same name and namespace in other branches
- 6 FeedsSourceCrawler.inc \FeedsSourceCrawler::import()
Import a feed: execute fetching, parsing and processing stage.
Return value
FEEDS_BATCH_COMPLETE if the import process finished. A decimal between 0.0 and 0.9 periodic if import is still in progress.
Throws
Throws Exception if an error occurs when importing.
Overrides FeedsSource::import
File
- ./
FeedsSourceCrawler.inc, line 7
Class
Code
public function import() {
try {
if (!isset($this->batch) || !$this->batch instanceof FeedsImportBatch) {
$this->batch = $this->importer->fetcher
->fetch($this);
$this->importer->parser
->parse($this->batch, $this);
module_invoke_all('feeds_after_parse', $this->importer, $this);
}
$this->raw = $this->batch
->getRaw();
$this->importer->processor
->process($this->batch, $this);
$result = $this->batch
->getProgress();
if ($result == FEEDS_BATCH_COMPLETE) {
unset($this->batch);
module_invoke_all('feeds_after_import', $this->importer, $this);
}
} catch (Exception $e) {
unset($this->batch);
throw $e;
}
return $result;
}