public function FeedsSource::progressImporting in Feeds 8.2
Report progress as float between 0 and 1. 1 = FEEDS_BATCH_COMPLETE.
2 calls to FeedsSource::progressImporting()
- FeedsSource::import in lib/
Drupal/ feeds/ FeedsSource.php - Import a source: execute fetching, parsing and processing stage.
- FeedsSource::scheduleImport in lib/
Drupal/ feeds/ FeedsSource.php - Schedule periodic or background import tasks.
File
- lib/
Drupal/ feeds/ FeedsSource.php, line 357 - 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 progressImporting() {
$fetcher = $this
->state(FEEDS_FETCH);
$parser = $this
->state(FEEDS_PARSE);
if ($fetcher->progress == FEEDS_BATCH_COMPLETE && $parser->progress == FEEDS_BATCH_COMPLETE) {
return FEEDS_BATCH_COMPLETE;
}
// Fetching envelops parsing.
// @todo: this assumes all fetchers neatly use total. May not be the case.
$fetcher_fraction = $fetcher->total ? 1.0 / $fetcher->total : 1.0;
$parser_progress = $parser->progress * $fetcher_fraction;
$result = $fetcher->progress - $fetcher_fraction + $parser_progress;
if ($result == FEEDS_BATCH_COMPLETE) {
return 0.99;
}
return $result;
}