Legacy_ModulePhasedUpgrader Class Reference

The framework for the phased update. More...

List of all members.

Public Member Functions

 setForceMode ($isForceMode)
 setCurrentXoopsModule (&$xoopsModule)
 setTargetXoopsModule (&$xoopsModule)
 executeUpgrade ()
 getCurrentVersion ()
 getTargetPhase ()
 hasUpgradeMethod ()
 _callUpgradeMethod ()
 isLatestUpgrade ()
 saveXoopsModule (&$module)
 _updateModuleTemplates ()
 _updateBlocks ()
 _updatePreferences ()
 executeAutomaticUpgrade ()
 _upgradePreferences ()

Public Attributes

 $_mMilestone = array()


Detailed Description

The framework for the phased update.

Description

You can make your own custom-update-installer for your modules with the sub-class of this class. It's easy to make by many utility functions. You can write your sub-class as well as batch files.

On Legacy System module, upgrade is called when users try to update. So you must implement your sub-class for also correct update. For example, the custom-update-install have to update module templates & block templates, because users expect that the module-update function does it.

For the custom-update-install, Legacy_ModuleInstallUtils is good for you. Plus, this class has some usefull static methods for upgrade. Such functions have notes as "The utility method for the custom-update-installer".

And, this class as the template-pattern has some methods you may override. These methods have note as "You may do custom".

Convention

Module Update function build the current-$xoopsModule from DB, and then sets it to this class through setCurrentXoopsModule(). Basically, you can access it by $this->_mCurrentXoopsModule. And, that function build the target-$xoopsModule from xoops_version, and then set it to this class through setTargetXoopsModule(). Also you can access it by $this->_mTargetXoopsModule.

See also:
Legacy_ModuleInstallUtils


Member Function Documentation

Legacy_ModulePhasedUpgrader::setForceMode ( isForceMode  ) 

Sets a value indicating whether the force mode is on.

Parameters:
bool $isForceMode

Legacy_ModulePhasedUpgrader::setCurrentXoopsModule ( &$  xoopsModule  ) 

Sets the current XoopsModule. This method creates the clone of this object to prevent cache of the module handler, and then keep it to the property. Plus, this method copies the version value of this object to the _mCurrentVersion as backup for the case where the value of this object is changed for updating.

Parameters:
XoopsModule $xoopsModule

Legacy_ModulePhasedUpgrader::setTargetXoopsModule ( &$  xoopsModule  ) 

Sets the target XoopsModule.

public

Parameters:
XoopsModule $xoopsModule

Legacy_ModulePhasedUpgrader::executeUpgrade (  ) 

Execute upgrade. If the specific method for the milestone, this method calls the method. If such milestone doesn't exist, call the automatic upgrade method.

public

Legacy_ModulePhasedUpgrader::getCurrentVersion (  ) 

Gets the current version.

Returns:
int

Legacy_ModulePhasedUpgrader::getTargetPhase (  ) 

Gets the target varsion number at this time. In the case where there are milestones, gets the nearest value from the current version.

Of course, this class is good to override by the sub-class.

Legacy_ModulePhasedUpgrader::hasUpgradeMethod (  ) 

Gets the valude indicating whether this class

Legacy_ModulePhasedUpgrader::_callUpgradeMethod (  ) 

Dispatches the callback upgrade program.

protected

Returns:
bool The value indicating whether this method can call the upgrade-method.

Legacy_ModulePhasedUpgrader::isLatestUpgrade (  ) 

Gets a valude indicating whether this process is upgrade for the latest version.

Returns:
bool

Legacy_ModulePhasedUpgrader::saveXoopsModule ( &$  module  ) 

Saves XoopsModule object to DB.

protected

Legacy_ModulePhasedUpgrader::_updateModuleTemplates (  ) 

Updates all of module templates.

protected

Note:
You may do custom

Legacy_ModulePhasedUpgrader::_updateBlocks (  ) 

Updates all of blocks.

protected

Note:
You may do custom

Legacy_ModulePhasedUpgrader::_updatePreferences (  ) 

Updates all of preferences & notifications.

protected

Note:
You may do custom

Legacy_ModulePhasedUpgrader::executeAutomaticUpgrade (  ) 

This method executes upgrading automatically by the diff of xoops_version.

1) Uninstall all of module templates 2) Install all of module templates

Returns:
bool

Legacy_ModulePhasedUpgrader::_upgradePreferences (  ) 

Tries to smart update all of preferences & notifications.

Todo:
This method is perhaps uncompleted. If you have written more smart function, please contribute it to us.
Note:
The utility method for the custom-update-installer.


Member Data Documentation

Legacy_ModulePhasedUpgrader::$_mMilestone = array()

This is an array of milestone version informations. Key is a version number. Value is a method name called by execute().

Format: {version} => {methodName}

Example: var $_mMilestone = array('020' => 'update020', '025' => 'update025');

protected


The documentation for this class was generated from the following file:
Generated on Thu Nov 2 00:27:13 2006 for XOOPS Cube Legacy by  doxygen 1.5.1