Short description for Upgrades

Long description for class Upgrades (if any)...

package Gems
subpackage Upgrades
copyright Copyright (c) 2011 Erasmus MC
license New BSD License
since Class available since version 1.5
inherited_from \Gems_UpgradesAbstract

 Methods

To upgrade from 143 to 15 we need to do some work: 1. execute db patches 42 and 43 2. create new tables

Upgrade143to150() 

To upgrade to 1.5.1 just execute patchlevel 44

Upgrade150to151() 

To upgrade to 1.5.2 just execute patchlevel 45

Upgrade151to152() 

To upgrade to 1.5.2 just execute patchlevel 46

Upgrade152to153() 

To upgrade to 1.5.4 just execute patchlevel 47

Upgrade153to154() 

To upgrade to 1.5.5 just execute patchlevel 48

Upgrade154to155() 

To upgrade to 1.5.6 just execute patchlevel 49

Upgrade155to156() 

To upgrade to 1.5.7 just execute patchlevel 50

Upgrade156to157() 

To upgrade to 1.6 just execute patchlevel 51

Upgrade157to16() 

To upgrade to 1.6.2 just execute patchlevel 53

Upgrade161to162() 

To upgrade to 1.6.3 just execute patchlevel 54

Upgrade162to163() 

To upgrade to 1.6.4 just execute patchlevel 55

Upgrade163to164() 

To upgrade to 1.7.0

Upgrade164to170() 

To upgrade to 1.6.1 just execute patchlevel 52

Upgrade16to161() 

To upgrade to 1.7.1

Upgrade170to171() 

To upgrade to 1.7.2

Upgrade171to172() 

To upgrade to 1.8.1

Upgrade172to181() 

__construct()

__construct() 
inherited_from \Gems_UpgradesAbstract::__construct()

__construct()

__construct(mixed $container, array $dirs) 
Inherited

Parameters

$container

mixed

A container acting as source for \MUtil_Registry_Source

$dirs

array

The directories where to look for requested classes

__get()

__get($name) 
Inherited

Parameters

$name

Add prefixed paths to the registry of paths

addPrefixPath(string $prefix, $path, boolean $prepend = true) : \Gems_Loader_LoaderAbstract
Inherited

Parameters

$prefix

string

$path

$prepend

boolean

Put path at the beginning of the stack (has no effect when prefix / dir already set)

Returns

\Gems_Loader_LoaderAbstract(continuation pattern)

Called after the check that all required registry values have been set correctly has run.

afterRegistry() : void
Inherited

Allows the loader to set resources.

answerRegistryRequest(string $name, mixed $resource) : boolean
Inherited

Parameters

$name

string

Name of resource to set

$resource

mixed

The resource.

Returns

booleanTrue if $resource was OK

Should be called after answering the request to allow the Target to check if all required registry values have been set correctly.

checkRegistryRequestsAnswers() : boolean
Inherited

Returns

booleanFalse if required values are missing.

Execute upgrades for the given $context

execute(string $context, integer|null $to = null, integer|null $from = null) : false | integer
Inherited

When no $to or $from are given, the given $context will be upgraded from the current level to the max level. Otherwise the $from and/or $to will be used to determine what upgrades to execute.

Parameters

$context

string

The context to execute the upgrades for

$to

integernull

The level to upgrade to

$from

integernull

The level to start the upgrade on

Returns

falseintegerThe achieved upgrade level or false on failure

Retrieve the current context

getContext() : string
Inherited

Returns

string

Get the current upgrade level for the given $context

getLevel(string $context) : integer
Inherited

Parameters

$context

string

Returns

integer

Get the highest level for the given $context

getMaxLevel(string|null $context = null) : integer
Inherited

Parameters

$context

stringnull

Returns

integer

Get all messages that were recorded during the upgrade process

getMessages() : array
Inherited

Returns

array

Get the next level for a given level and context

getNextLevel(\type $context = null, \type $level = null) : \type
Inherited

When context is null, it will get the current context When level is null, it will get the current level

Parameters

$context

\type

$level

\type

Returns

\type

Allows the loader to know the resources to set.

getRegistryRequests() : array
Inherited

Returns those object variables defined by the subclass but not at the level of this definition.

Can be overruled.

Returns

arrayof string names

Retrieve the upgrades for a certain context, will return an empty array when nothing present.

getUpgrades(string $context = null) : array
Inherited

Parameters

$context

string

Returns

array

Retrieve info about the $requestedContext or all contexts when omitted

getUpgradesInfo(string $requestedContext = null) : array
Inherited

Parameters

$requestedContext

string

Returns

array

Register an upgrade in the stack, it can be executed by using $this->execute

register(array|string $callback, string $info = null, integer $index = null, string $context = null) : boolean
Inherited

Index and context are optional and will be generated when omitted. For the user interface to be clear $info should provide a good description of what the upgrade does.

Parameters

$callback

arraystring

A valid callback, either string for a method of the current class or array otherwise

$info

string

A descriptive message about what this upgrade does

$index

integer

The number of the upgrade

$context

string

The context to which this upgrade applies

Returns

boolean

Set the batch to use

setBatch(\Gems_Task_TaskRunnerBatch $batch) 
Inherited

Parameters

$batch

\Gems_Task_TaskRunnerBatch

Change the active context

setContext(string $context) 
Inherited

Usefull when adding upgrades in the construct to save typing

Parameters

$context

string

Proxy to the translate object

_(string $messageId, \type $locale = null) : string
Inherited

Parameters

$messageId

string

$locale

\type

Returns

string

Add a subdirectory / sub name to a list of class load paths

_cascadedDirs(array $dirs, string $cascade, boolean $fullClassnameFallback = true) : array
Inherited

Parameters

$dirs

array

prefix => path

$cascade

string

The sub directories to cascade to

$fullClassnameFallback

boolean

Allows full class name specification instead of just plugin name part

Returns

arrayprefix => path

Returns $this->$name, creating the item if it does not yet exist.

_getClass(string $name, string $className = null, array $arguments = array()) : mixed
Inherited

Parameters

$name

string

The $name of the variable to store this object in.

$className

string

Class name or null if the same as $name, prepending $this->_dirs.

$arguments

array

Class initialization arguments.

Returns

mixedInstance of $className

Create or loads the class. When only loading, this function returns a StaticCall object that can be invoked lazely.

_loadClass(string $name, boolean $create = false, array $arguments = array()) : mixed
Inherited
see
see

Parameters

$name

string

The class name, minus the part in $this->_dirs.

$create

boolean

Create the object, or only when an \MUtil_Registry_TargetInterface instance.

$arguments

array

Class initialization arguments.

Returns

mixedA class instance or a \MUtil_Lazy_StaticCall object

Add a message to the stack

addMessage(string $message) 
Inherited

Parameters

$message

string

Reset the message stack

clearMessages() 
Inherited

Filters the names that should not be requested.

filterRequestNames(string $name) : boolean
Inherited

Can be overriden.

Parameters

$name

string

Returns

boolean

Set the upgrade level for the given $context to a certain level

setLevel(string $context, integer $level = null, boolean $force = false
Inherited

Will only update when the $level is higher than the achieved level, unless when $force = true when it will always update.

Parameters

$context

string

$level

integer

$force

boolean

 Properties

 

$db

$db : \Zend_Db_Adapter_Abstract

Default

 

$loader

$loader : \Gems_Loader

Default

 

$project

$project : \Gems_Project_ProjectSettings

Default

 

$translate

$translate : \Zend_Translate_Adapter

Default

 

$_batch

$_batch : \Gems_Task_TaskRunnerBatch

Default

 

$_context

$_context 

Default

null
 

The prefix/path location to look for classes.

$_dirs : array

Default

The standard value is

  • => application/classes
  • Gems => library/Gems/classes

But an alternative could be:

  • Demopulse => application/classes
  • Pulse => application/classes
  • Gems => library/Gems/classes
 

$_info

$_info : \Zend_Config_Ini

Default

 

$_loader

$_loader : \MUtil_Loader_PluginLoader

Default

 

$_messages

$_messages 

Default

array()
 

$_upgradeStack

$_upgradeStack 

Default

array()
 

Allows sub classes of \Gems_Loader_LoaderAbstract to specify the subdirectory where to look for.

$cascade : string

Default

null
 

Holds the inital config file

$originalFile : \Zend_Config

Default

 

Holds the config file specific to this environment

$upgradeFile : \Zend_Config

Default