public function FeedsBatch::getProgress in Feeds 7
Same name and namespace in other branches
- 6 includes/FeedsBatch.inc \FeedsBatch::getProgress()
Report progress.
Parameters
$stage: The stage to set the progress for. One of FEEDS_FETCHING, FEEDS_PARSING, FEEDS_PROCESING or FEEDS_CLEARING.
File
- includes/
FeedsBatch.inc, line 60
Class
- FeedsBatch
- A FeedsBatch object holds the state of an import or clear batch.
Code
public function getProgress($stage = NULL) {
if ($stage) {
$progress = $this->progress[$stage];
if ($progress == FEEDS_BATCH_COMPLETE) {
return FEEDS_BATCH_COMPLETE;
}
$total = $this->total[$stage];
}
else {
$complete = TRUE;
$progress = 0;
foreach ($this->progress as $p) {
$progress += $p;
$complete &= $p == FEEDS_BATCH_COMPLETE;
}
if ($complete) {
return FEEDS_BATCH_COMPLETE;
}
$total = array_sum($this->total);
}
$progress = 1.0 / $total * $progress;
return $progress == FEEDS_BATCH_COMPLETE ? 0.999 : $progress;
}