Elgg  Version 3.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\UpgradeService Class Reference

Upgrade service for Elgg. More...

Public Member Functions

 __construct (Locator $locator, Translator $translator, EventsService $events, Config $config, Logger $logger, Mutex $mutex, SystemMessagesService $system_messages, Progress $progress)
 Constructor. More...
 
 run ($upgrades=null)
 Run the upgrade process. More...
 
 getPendingUpgrades ($async=true)
 Get pending async upgrades. More...
 
 getCompletedUpgrades ($async=true)
 Get completed (async) upgrades. More...
 
 executeUpgrade (ElggUpgrade $upgrade, $max_duration=null)
 Call the upgrade's run() for a specified period of time, or until it completes. More...
 

Protected Member Functions

 up ()
 Start an upgrade process. More...
 
 down ()
 Finish an upgrade process. More...
 
 runLegacyUpgrades ()
 Run legacy upgrade scripts. More...
 
 runUpgrades ($upgrades)
 Run system and async upgrades. More...
 
 upgradeCode ($version, $quiet=false)
 Run any php upgrade scripts which are required. More...
 
 setProcessedUpgrade ($upgrade)
 Saves a processed upgrade to a dataset. More...
 
 getProcessedUpgrades ()
 Gets a list of processes upgrades. More...
 
 getUpgradeFileVersion ($filename)
 Returns the version of the upgrade filename. More...
 
 getUpgradeFiles ($upgrade_path=null)
 Returns a list of upgrade files relative to the $upgrade_path dir. More...
 
 getUnprocessedUpgrades ($upgrade_files=null, $processed_upgrades=null)
 Checks if any upgrades need to be run. More...
 
 processUpgrades ()
 Upgrades Elgg Database and code. More...
 

Protected Attributes

 $locator
 
 $progress
 

Detailed Description

Upgrade service for Elgg.

Definition at line 23 of file UpgradeService.php.

Constructor & Destructor Documentation

Elgg\UpgradeService::__construct ( Locator  $locator,
Translator  $translator,
EventsService  $events,
Config  $config,
Logger  $logger,
Mutex  $mutex,
SystemMessagesService  $system_messages,
Progress  $progress 
)

Constructor.

Parameters
Locator$locatorUpgrade locator
Translator$translatorTranslation service
EventsService$eventsEvents service
Config$configConfig
Logger$loggerLogger
Mutex$mutexDatabase mutex service
SystemMessagesService$system_messagesSystem messages
Progress$progressProgress

Definition at line 74 of file UpgradeService.php.

Member Function Documentation

Elgg\UpgradeService::down ( )
protected

Finish an upgrade process.

Returns
Promise

Definition at line 123 of file UpgradeService.php.

Elgg\UpgradeService::executeUpgrade ( ElggUpgrade  $upgrade,
  $max_duration = null 
)

Call the upgrade's run() for a specified period of time, or until it completes.

Parameters
ElggUpgrade$upgradeUpgrade to run
int$max_durationMaximum duration in seconds Set to false to execute an entire upgrade
Returns
Result
Exceptions
RuntimeException

Definition at line 539 of file UpgradeService.php.

Elgg\UpgradeService::getCompletedUpgrades (   $async = true)

Get completed (async) upgrades.

Parameters
bool$asyncInclude async upgrades
Returns
ElggUpgrade[]

Definition at line 496 of file UpgradeService.php.

Elgg\UpgradeService::getPendingUpgrades (   $async = true)

Get pending async upgrades.

Parameters
bool$asyncInclude async upgrades
Returns
ElggUpgrade[]

Definition at line 462 of file UpgradeService.php.

Elgg\UpgradeService::getProcessedUpgrades ( )
protected

Gets a list of processes upgrades.

Returns
mixed Array of processed upgrade filenames or false

Definition at line 340 of file UpgradeService.php.

Elgg\UpgradeService::getUnprocessedUpgrades (   $upgrade_files = null,
  $processed_upgrades = null 
)
protected

Checks if any upgrades need to be run.

Parameters
null | array$upgrade_filesOptional upgrade files
null | array$processed_upgradesOptional processed upgrades
Returns
array

Definition at line 417 of file UpgradeService.php.

Elgg\UpgradeService::getUpgradeFiles (   $upgrade_path = null)
protected

Returns a list of upgrade files relative to the $upgrade_path dir.

Parameters
string$upgrade_pathThe up
Returns
array|false

Definition at line 373 of file UpgradeService.php.

Elgg\UpgradeService::getUpgradeFileVersion (   $filename)
protected

Returns the version of the upgrade filename.

Parameters
string$filenameThe upgrade filename. No full path.
Returns
int|false
Since
1.8.0

Definition at line 354 of file UpgradeService.php.

Elgg\UpgradeService::processUpgrades ( )
protected

Upgrades Elgg Database and code.

Returns
bool

Definition at line 445 of file UpgradeService.php.

Elgg\UpgradeService::run (   $upgrades = null)

Run the upgrade process.

Parameters
ElggUpgrade[]$upgrades Upgrades to run
Returns
Promise
Exceptions
RuntimeException

Definition at line 199 of file UpgradeService.php.

Elgg\UpgradeService::runLegacyUpgrades ( )
protected

Run legacy upgrade scripts.

Returns
Promise

Definition at line 145 of file UpgradeService.php.

Elgg\UpgradeService::runUpgrades (   $upgrades)
protected

Run system and async upgrades.

Parameters
ElggUpgrade[]$upgrades Upgrades to run
Returns
Promise

Definition at line 162 of file UpgradeService.php.

Elgg\UpgradeService::setProcessedUpgrade (   $upgrade)
protected

Saves a processed upgrade to a dataset.

Parameters
string$upgradeFilename of the processed upgrade (not the path, just the file)
Returns
bool

Definition at line 325 of file UpgradeService.php.

Elgg\UpgradeService::up ( )
protected

Start an upgrade process.

Returns
Promise

Definition at line 98 of file UpgradeService.php.

Elgg\UpgradeService::upgradeCode (   $version,
  $quiet = false 
)
protected

Run any php upgrade scripts which are required.

Parameters
int$versionVersion upgrading from.
bool$quietSuppress errors. Don't use this.
Returns
bool

Definition at line 252 of file UpgradeService.php.

Member Data Documentation

Elgg\UpgradeService::$locator
protected

Definition at line 30 of file UpgradeService.php.

Elgg\UpgradeService::$progress
protected

Definition at line 60 of file UpgradeService.php.


The documentation for this class was generated from the following file: