78 if ($md->value !== -1) {
84 $method =
substr($md->name,
strlen(
'collections_notifications_preferences_'));
85 $user = $md->getEntity();
88 $user->setNotificationSetting($method,
true,
'friends');
Interface to be implement for asynchronous upgrades, i.e.
run(Result $result, $offset)
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.Result of the batch (this must be returned) Number to skip when processingResult
addFailures(int $num=1)
Increment failure count.
Database abstraction query builder.
getVersion()
Version of the upgrade.This tells the date when the upgrade was added. It consists of eight digits an...
addSuccesses(int $num=1)
Set an item (or items) as successfully upgraded.
Migrate the old access collection notification preferences to the new logic The old settings are from...
compare($x, $comparison, $y=null, $type=null, $case_sensitive=null)
Build value comparison clause.
Result of a single BatchUpgrade run.
shouldBeSkipped()
Should this upgrade be skipped?If true, the upgrade will not be performed and cannot be accessed late...
needsIncrementOffset()
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.bool
countItems()
The total number of items to process during the upgrade.If unknown, Batch::UNKNOWN_COUNT should be re...