class FeedsState in Feeds 7.2
Status of an import or clearing operation on a source.
Hierarchy
- class \FeedsState
Expanded class hierarchy of FeedsState
File
- includes/
FeedsSource.inc, line 74 - Definition of FeedsSourceInterface, FeedsState and FeedsSource class.
View source
class FeedsState {
/**
* Floating point number denoting the progress made.
*
* 0.0 meaning no progress.
* 1.0 = FEEDS_BATCH_COMPLETE, meaning finished.
*
* @var float
*/
public $progress;
/**
* Used as a pointer to store where left off. Must be serializable.
*
* @var mixed
*/
public $pointer;
/**
* Natural numbers denoting more details about the progress being made.
*
* @var int
*/
public $total;
public $created;
public $updated;
public $deleted;
public $unpublished;
public $blocked;
public $skipped;
public $failed;
/**
* IDs of entities to be removed.
*
* @var array
*/
public $removeList;
/**
* Constructor, initialize variables.
*/
public function __construct() {
$this->progress = FEEDS_BATCH_COMPLETE;
$this->total = $this->created = $this->updated = $this->deleted = $this->unpublished = $this->blocked = $this->skipped = $this->failed = 0;
}
/**
* Safely report progress.
*
* When $total == $progress, the state of the task tracked by this state is
* regarded to be complete.
*
* Handles the following cases gracefully:
*
* - $total is 0
* - $progress is larger than $total
* - $progress approximates $total so that $finished rounds to 1.0
*
* @param int $total
* A natural number that is the total to be worked off.
* @param int $progress
* A natural number that is the progress made on $total.
*/
public function progress($total, $progress) {
if ($progress > $total) {
$this->progress = FEEDS_BATCH_COMPLETE;
}
elseif ($total) {
$this->progress = (double) $progress / $total;
if ($this->progress == FEEDS_BATCH_COMPLETE && $total != $progress) {
$this->progress = 0.99;
}
}
else {
$this->progress = FEEDS_BATCH_COMPLETE;
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FeedsState:: |
public | property | ||
FeedsState:: |
public | property | ||
FeedsState:: |
public | property | ||
FeedsState:: |
public | property | ||
FeedsState:: |
public | property | Used as a pointer to store where left off. Must be serializable. | |
FeedsState:: |
public | property | Floating point number denoting the progress made. | |
FeedsState:: |
public | property | IDs of entities to be removed. | |
FeedsState:: |
public | property | ||
FeedsState:: |
public | property | Natural numbers denoting more details about the progress being made. | |
FeedsState:: |
public | property | ||
FeedsState:: |
public | property | ||
FeedsState:: |
public | function | Safely report progress. | |
FeedsState:: |
public | function | Constructor, initialize variables. |