Elgg  Version master
Batch.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Upgrade;
4 
10 abstract class Batch {
11 
15  const UNKNOWN_COUNT = -1;
16 
22  public function __construct(protected ?\ElggUpgrade $upgrade = null) {
23  }
24 
39  abstract public function getVersion(): int;
40 
48  abstract public function shouldBeSkipped(): bool;
49 
63  abstract public function needsIncrementOffset(): bool;
64 
73  abstract public function countItems(): int;
74 
86  abstract public function run(Result $result, $offset): Result;
87 
94  final public function getUpgrade(): ?\ElggUpgrade {
95  return $this->upgrade;
96  }
97 }
if(empty($guid)) $upgrade
Definition: upgrade.php:11
return[ 'admin/delete_admin_notices'=>['access'=> 'admin'], 'admin/menu/save'=>['access'=> 'admin'], 'admin/plugins/activate'=>['access'=> 'admin'], 'admin/plugins/activate_all'=>['access'=> 'admin'], 'admin/plugins/deactivate'=>['access'=> 'admin'], 'admin/plugins/deactivate_all'=>['access'=> 'admin'], 'admin/plugins/set_priority'=>['access'=> 'admin'], 'admin/security/security_txt'=>['access'=> 'admin'], 'admin/security/settings'=>['access'=> 'admin'], 'admin/security/regenerate_site_secret'=>['access'=> 'admin'], 'admin/site/cache/invalidate'=>['access'=> 'admin'], 'admin/site/flush_cache'=>['access'=> 'admin'], 'admin/site/icons'=>['access'=> 'admin'], 'admin/site/set_maintenance_mode'=>['access'=> 'admin'], 'admin/site/set_robots'=>['access'=> 'admin'], 'admin/site/theme'=>['access'=> 'admin'], 'admin/site/unlock_upgrade'=>['access'=> 'admin'], 'admin/site/settings'=>['access'=> 'admin'], 'admin/upgrade'=>['access'=> 'admin'], 'admin/upgrade/reset'=>['access'=> 'admin'], 'admin/user/ban'=>['access'=> 'admin'], 'admin/user/bulk/ban'=>['access'=> 'admin'], 'admin/user/bulk/delete'=>['access'=> 'admin'], 'admin/user/bulk/unban'=>['access'=> 'admin'], 'admin/user/bulk/validate'=>['access'=> 'admin'], 'admin/user/change_email'=>['access'=> 'admin'], 'admin/user/delete'=>['access'=> 'admin'], 'admin/user/login_as'=>['access'=> 'admin'], 'admin/user/logout_as'=>[], 'admin/user/makeadmin'=>['access'=> 'admin'], 'admin/user/resetpassword'=>['access'=> 'admin'], 'admin/user/removeadmin'=>['access'=> 'admin'], 'admin/user/unban'=>['access'=> 'admin'], 'admin/user/validate'=>['access'=> 'admin'], 'annotation/delete'=>[], 'avatar/upload'=>[], 'comment/save'=>[], 'diagnostics/download'=>['access'=> 'admin'], 'entity/chooserestoredestination'=>[], 'entity/delete'=>[], 'entity/mute'=>[], 'entity/restore'=>[], 'entity/subscribe'=>[], 'entity/trash'=>[], 'entity/unmute'=>[], 'entity/unsubscribe'=>[], 'login'=>['access'=> 'logged_out'], 'logout'=>[], 'notifications/mute'=>['access'=> 'public'], 'plugins/settings/remove'=>['access'=> 'admin'], 'plugins/settings/save'=>['access'=> 'admin'], 'plugins/usersettings/save'=>[], 'register'=>['access'=> 'logged_out', 'middleware'=>[\Elgg\Router\Middleware\RegistrationAllowedGatekeeper::class,],], 'river/delete'=>[], 'settings/notifications'=>[], 'settings/notifications/subscriptions'=>[], 'user/changepassword'=>['access'=> 'public'], 'user/requestnewpassword'=>['access'=> 'public'], 'useradd'=>['access'=> 'admin'], 'usersettings/save'=>[], 'widgets/add'=>[], 'widgets/delete'=>[], 'widgets/move'=>[], 'widgets/save'=>[],]
Definition: actions.php:73
Represents an upgrade that runs outside of the upgrade.php script.
Definition: ElggUpgrade.php:26
Long running upgrades should implement this interface.
Definition: Batch.php:10
__construct(protected ?\ElggUpgrade $upgrade=null)
Constructs a upgrade batch.
Definition: Batch.php:22
run(Result $result, $offset)
Runs upgrade on a single batch of items.
getVersion()
Version of the upgrade.
getUpgrade()
Returns the related upgrade entity.
Definition: Batch.php:94
const UNKNOWN_COUNT
countItems() should return this if it doesn't know how many items remain.
Definition: Batch.php:15
needsIncrementOffset()
Should the run() method receive an offset representing all processed items?
countItems()
The total number of items to process during the upgrade.
shouldBeSkipped()
Should this upgrade be skipped?
Result of a single BatchUpgrade run.
Definition: Result.php:10
if(empty($count)) $offset
Definition: pagination.php:26