Long running upgrades should implement this interface.
More...
Long running upgrades should implement this interface.
- Since
- 3.0.0
Definition at line 10 of file Batch.php.
Elgg\Upgrade\Batch::__construct |
( |
protected?\ElggUpgrade |
$upgrade = null | ) |
|
Constructs a upgrade batch.
- Parameters
-
\ElggUpgrade | $upgrade | the upgrade related to this batch |
Definition at line 22 of file Batch.php.
Elgg\Upgrade\Batch::countItems |
( |
| ) |
|
|
abstract |
The total number of items to process during the upgrade.
If unknown, Batch::UNKNOWN_COUNT should be returned, and run() must manually mark the result as complete.
- Returns
- int
Elgg\Upgrade\Batch::getUpgrade |
( |
| ) |
|
|
final |
Returns the related upgrade entity.
- Returns
- |null
- Since
- 5.0
Definition at line 94 of file Batch.php.
Elgg\Upgrade\Batch::getVersion |
( |
| ) |
|
|
abstract |
Version of the upgrade.
This tells the date when the upgrade was added. It consists of eight digits and is in format yyyymmddnn
where:
yyyy
is the year
mm
is the month (with leading zero)
dd
is the day (with leading zero)
nn
is an incrementing number (starting from 00
) that is used in case two separate upgrades have been added during the same day
- Returns
- int E.g. 2016123101
Elgg\Upgrade\Batch::needsIncrementOffset |
( |
| ) |
|
|
abstract |
Should the run() method receive an offset representing all processed items?
If true, run() will receive as $offset the number of items already processed. This is useful if you are only modifying data, and need to use the $offset in a function like elgg_get_entities*() to know how many to skip over.
If false, run() will receive as $offset the total number of failures. This should be used if your process deletes or moves data out of the way of the process. E.g. if you delete 50 objects on each run(), you may still use the $offset to skip objects that already failed once.
- Returns
- bool
Elgg\Upgrade\Batch::run |
( |
Result |
$result, |
|
|
|
$offset |
|
) |
| |
|
abstract |
Runs upgrade on a single batch of items.
If countItems() returns Batch::UNKNOWN_COUNT, this method must call $result->markCompleted() when the upgrade is complete.
- Parameters
-
Result | $result | Result of the batch (this must be returned) |
int | $offset | Number to skip when processing |
- Returns
- Result
Elgg\Upgrade\Batch::shouldBeSkipped |
( |
| ) |
|
|
abstract |
Should this upgrade be skipped?
If true, the upgrade will not be performed and cannot be accessed later.
- Returns
- bool
const Elgg\Upgrade\Batch::UNKNOWN_COUNT = -1 |
The documentation for this class was generated from the following file: