XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
Legacy_ModulePhasedUpgrader Class Reference

The framework for the phased update. More...

Inheritance diagram for Legacy_ModulePhasedUpgrader:
Legacy_ModuleUpdater Message_myUpdater

Public Member Functions

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

Data Fields

 $_mMilestone = []
 
 $mLog = null
 
 $_mCurrentXoopsModule
 
 $_mCurrentVersion
 
 $_mTargetXoopsModule
 
 $_mTargetVersion
 
 $_mForceMode = false
 

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

Definition at line 49 of file ModuleUpdater.class.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 104 of file ModuleUpdater.class.php.

Member Function Documentation

◆ _callUpgradeMethod()

_callUpgradeMethod ( )

Dispatches the callback upgrade program.

@access protected

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

Definition at line 234 of file ModuleUpdater.class.php.

◆ _processReport()

_processReport ( )

Definition at line 294 of file ModuleUpdater.class.php.

◆ _processScript()

_processScript ( )

Definition at line 276 of file ModuleUpdater.class.php.

◆ _updateBlocks()

_updateBlocks ( )

Updates all of blocks.

@access protected

Note
You may do custom

Definition at line 321 of file ModuleUpdater.class.php.

◆ _updateModuleTemplates()

_updateModuleTemplates ( )

Updates all of module templates.

@access protected

Note
You may do custom

Definition at line 309 of file ModuleUpdater.class.php.

◆ _updatePreferences()

_updatePreferences ( )

Updates all of preferences & notifications.

@access protected

Note
You may do custom

Definition at line 332 of file ModuleUpdater.class.php.

◆ executeAutomaticUpgrade()

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

Definition at line 346 of file ModuleUpdater.class.php.

◆ executeUpgrade()

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.

@access public

Definition at line 171 of file ModuleUpdater.class.php.

◆ getCurrentVersion()

getCurrentVersion ( )

Gets the current version.

Returns
int

Definition at line 185 of file ModuleUpdater.class.php.

◆ getTargetPhase()

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.

Definition at line 196 of file ModuleUpdater.class.php.

◆ hasUpgradeMethod()

hasUpgradeMethod ( )

Gets the valude indicating whether this class

Definition at line 212 of file ModuleUpdater.class.php.

◆ isLatestUpgrade()

isLatestUpgrade ( )

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

Returns
bool

Definition at line 255 of file ModuleUpdater.class.php.

◆ Legacy_ModulePhasedUpgrader()

Definition at line 100 of file ModuleUpdater.class.php.

◆ saveXoopsModule()

saveXoopsModule ( & $module)

Saves XoopsModule object to DB.

@access protected

Parameters
$module

Definition at line 266 of file ModuleUpdater.class.php.

◆ setCurrentXoopsModule()

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

Definition at line 128 of file ModuleUpdater.class.php.

◆ setForceMode()

setForceMode ( $isForceMode)

Sets a value indicating whether the force mode is on.

Parameters
bool$isForceMode

Definition at line 113 of file ModuleUpdater.class.php.

◆ setTargetXoopsModule()

setTargetXoopsModule ( & $xoopsModule)

Sets the target XoopsModule.

@access public

Parameters
XoopsModule$xoopsModule

Definition at line 158 of file ModuleUpdater.class.php.

Field Documentation

◆ $_mCurrentVersion

$_mCurrentVersion

Definition at line 82 of file ModuleUpdater.class.php.

◆ $_mCurrentXoopsModule

$_mCurrentXoopsModule

Definition at line 77 of file ModuleUpdater.class.php.

◆ $_mForceMode

$_mForceMode = false

Definition at line 98 of file ModuleUpdater.class.php.

◆ $_mMilestone

$_mMilestone = []

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

Format: {version} => {methodName}

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

@access protected

Definition at line 63 of file ModuleUpdater.class.php.

◆ $_mTargetVersion

$_mTargetVersion

Definition at line 93 of file ModuleUpdater.class.php.

◆ $_mTargetXoopsModule

$_mTargetXoopsModule

Definition at line 88 of file ModuleUpdater.class.php.

◆ $mLog

$mLog = null

Definition at line 71 of file ModuleUpdater.class.php.


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