Elgg  Version 1.11
Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
Elgg\UpgradeService Class Reference

Public Member Functions

 __construct ()
 Constructor. More...
 
 run ()
 Run the upgrade process. More...
 
 releaseUpgradeMutex ()
 Unlocks upgrade. More...
 
 isUpgradeLocked ()
 Checks if upgrade is locked. More...
 

Protected Member Functions

 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...
 
 bootstrap17to18 ()
 Boot straps into 1.8 upgrade system from 1.7. More...
 
 getUpgradeMutex ()
 Creates a table {prefix}upgrade_lock that is used as a mutex for upgrades. More...
 
 dbUpgrade ($version, $fromdir="", $quiet=false)
 

NOTE: If this is ever removed from Elgg, sites lose the ability to upgrade from 1.7.x and earlier to the latest version of Elgg without upgrading to 1.8 first. More...

 

Static Protected Member Functions

static includeCode ($file)
 PHP include a file with a very limited scope. More...
 

Detailed Description

Definition at line 15 of file UpgradeService.php.

Constructor & Destructor Documentation

Elgg\UpgradeService::__construct ( )

Constructor.

Definition at line 27 of file UpgradeService.php.

Member Function Documentation

Elgg\UpgradeService::bootstrap17to18 ( )
protected

Boot straps into 1.8 upgrade system from 1.7.

This runs all the 1.7 upgrades, then sets the processed_upgrades to all existing 1.7 upgrades. Control is then passed back to the main upgrade function which detects and runs the 1.8 upgrades, regardless of filename convention.

Returns
bool

Definition at line 308 of file UpgradeService.php.

Elgg\UpgradeService::dbUpgrade (   $version,
  $fromdir = "",
  $quiet = false 
)
protected


NOTE: If this is ever removed from Elgg, sites lose the ability to upgrade from 1.7.x and earlier to the latest version of Elgg without upgrading to 1.8 first.


Upgrade the database schema in an ordered sequence.

Executes all upgrade files in elgg/engine/schema/upgrades/ in sequential order. Upgrade files must be in the standard Elgg release format of YYYYMMDDII.sql where II is an incrementor starting from 01.

Files that are < $version will be ignored.

Parameters
int$versionThe version you are upgrading from in the format YYYYMMDDII.
string$fromdirOptional directory to load upgrades from. default: engine/schema/upgrades/
bool$quietIf true, suppress all error messages. Only use for the upgrade from <=1.6.
Returns
int The number of upgrades run.

Definition at line 404 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 181 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 248 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 210 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 194 of file UpgradeService.php.

Elgg\UpgradeService::getUpgradeMutex ( )
protected

Creates a table {prefix}upgrade_lock that is used as a mutex for upgrades.

Returns
bool

Definition at line 344 of file UpgradeService.php.

static Elgg\UpgradeService::includeCode (   $file)
staticprotected

PHP include a file with a very limited scope.

Parameters
string$fileFile path to include
Returns
mixed

Definition at line 155 of file UpgradeService.php.

Elgg\UpgradeService::isUpgradeLocked ( )

Checks if upgrade is locked.

Returns
bool

Definition at line 374 of file UpgradeService.php.

Elgg\UpgradeService::processUpgrades ( )
protected

Upgrades Elgg Database and code.

Returns
bool

Definition at line 269 of file UpgradeService.php.

Elgg\UpgradeService::releaseUpgradeMutex ( )

Unlocks upgrade.

Returns
void

Definition at line 363 of file UpgradeService.php.

Elgg\UpgradeService::run ( )

Run the upgrade process.

Returns
array

Definition at line 37 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 169 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 78 of file UpgradeService.php.


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