Class ComponentUpdate
- TableAccess
- Component
- ComponentUpdate
License: GNU General Public License v2.0 only **********************************************************************************************
B:
adm_program/installation/db_scripts and for plugins there should be an install folder within the plugin directory. The xml files should have the prefix update and than the main und subversion within their filename e.g. @b update_3_0.xml .
Brief:
Manage the update of a component from the actual version to the target version
The class is an extension to the component class and will handle the update of a component. It will read the database version from the component and set this as source version. Then you should set the target version. The class will then search search for specific update xml files in special directories. For the system this should be
Class: ComponentUpdate
Code:
// update the system module to the actual filesystem version $componentUpdateHandle = new ComponentUpdate($gDb); $componentUpdateHandle->readDataByColumns(array('com_type' => 'SYSTEM', 'com_name_intern' => 'CORE')); $componentUpdateHandle->setTargetVersion(ADMIDIO_VERSION); $componentUpdateHandle->update(); @endcode
Par: Examples
Located at componentupdate.php
Methods summary
private
boolean
|
#
createXmlObject( string|integer $mainVersion, string|integer $subVersion )
Will open a XML file of a specific version that contains all the update steps that must be passed to successfully update Admidio to this version |
private
|
#
executeStep( SimpleXMLElement $xmlNode )
Will execute the specific update step that is set through the parameter $xmlNode. If the step was successfully done the id will be stored in the component recordset so if the whole update crashs later we know that this step was successfully executed. When the node has an attribute @b database than this sql statement will only executed if the value of the attribute is equal to your current @b $gDbType . If the node has an attribute @b error and this is set to @b ignore than an sql error will not stop the update script. |
public
integer
|
#
getMaxUpdateStep( )
Goes step by step through the update xml file of the current database version and search for the maximum step. If the last step is found than the id of this step will be returned. |
public
|
#
setTargetVersion( string $version )
Set the target version for the component after update. This information should be read from the files of the component. |
public
|
|
public
|
|
public
|
#
updateStepMigrateToFolderRights( )
This method migrate the data of the table adm_folder_roles to the new table adm_roles_rights_data. |
public
|
#
updateStepNewDownloadRootFolderName( )
Create a unique folder name for the root folder of the download module that contains the shortname of the current organization |
public
|
#
updateStepRenameWebmasterToAdministrator( )
This method renames the webmaster role to administrator. |
public
|
#
updateStepSetDefaultConfiguration( )
This method set the default configuration for all organizations |
Methods inherited from Component
Methods inherited from TableAccess
__sleep()
,
clear()
,
connectAdditionalTable()
,
countAllRecords()
,
delete()
,
getValue()
,
hasColumnsValueChanged()
,
isNewRecord()
,
readData()
,
readDataByColumns()
,
readDataById()
,
save()
,
setArray()
,
setDatabase()
,
setValue()
Properties summary
private
|
$updateFinished
|
|
private
|
$xmlObject
|
|
private
|
$currentVersionArray
|
|
private
|
$targetVersionArray
|
Properties inherited from TableAccess
$additionalTables
,
$columnPrefix
,
$columnsInfos
,
$columnsValueChanged
,
$db
,
$dbColumns
,
$keyColumnName
,
$new_record
,
$tableName