Class moduleInstaller

Description

class for installing a module or upgrading it.

base actions are:

install: registers the module into the database

update: checks module version in database and perform any needed updates e.g. from version 1.04 to 1.07 or 0.01 to 0.07 If more upgrades exist. Upgrade all one after one.

remove: removes the module from the modules table and also tables connected to module.

Located in /lib/moduleInstaller.php (line 37)

db
   |
   --moduleInstaller
Variable Summary
string $confirm
array $error
array $installInfo
Method Summary
static array getModules ()
moduleInstaller __construct ([string $options = null])
boolean deleteMenuItem ([string $module = null])
array|false getModuleInfo ()
array getSqlFileList (string $module, string $action)
array getSqlFileListOrdered (string $module, string $action, [float $specific = null], [float $current = null])
string getSqlFileName (string $module, float $version, string $action)
string getSqlFileString (string $module, float $version, string $action)
boolean insertLanguage ([ $module = null])
boolean insertMenuItem ()
boolean install (string 0)
boolean isInstalled ()
void reloadLanguages ()
void setInstallInfo (string $options)
boolean uninstall ()
int upgrade ([float $specific = null])
void upgradeAll ()
Variables
string $confirm (line 57)
  • var: holding confirm message
  • access: public
array $error (line 51)
  • var: holding errors
  • access: public
array $installInfo (line 45)
  • var: holding array of info for the install this is loaded from install.inc file and will read the $_INSTALL var
  • access: public

Inherited Variables

Inherited from db

db::$dbh
db::$debug
Methods
static getModules (line 167)
  • return: assoc array of all modules
  • access: public
static array getModules ()
Constructor __construct (line 66)

constructor which will take the module to install, upgrade or delete as param and set info about module to be installed, upgraded, etc.

if module is set

moduleInstaller __construct ([string $options = null])
  • string $options: name of module to do operations on

Redefinition of:
db::__construct()
constructor will try to call method connect
deleteMenuItem (line 406)

method for deling modules menu item when uninstalling

  • return: true or throws an error on failure
  • access: public
boolean deleteMenuItem ([string $module = null])
  • string $module: modulename to uninstall
getLanguagesInstalled (line 190)
  • return: assoc row with language installed
  • access: public
array getLanguagesInstalled ()
getModuleInfo (line 149)

method for getting module info. Info is read from database

  • return: false or array if module we search for exists, we return the install row else we return false
  • access: public
array|false getModuleInfo ()
getSqlFileList (line 285)
  • return: array with file list
  • access: public
array getSqlFileList (string $module, string $action)
  • string $module
  • string $action: (up or down)
getSqlFileListOrdered (line 303)
  • return: array sorted according to version
  • access: public
array getSqlFileListOrdered (string $module, string $action, [float $specific = null], [float $current = null])
  • string $module
  • string $action
  • float $specific: specific version
  • float $current: current version
getSqlFileName (line 259)
  • return: sql filename
  • access: public
string getSqlFileName (string $module, float $version, string $action)
  • string $module
  • float $version
  • string $action: (up or down)
getSqlFileString (line 271)
  • access: public
string getSqlFileString (string $module, float $version, string $action)
  • string $module
  • float $version
  • string $action: (up or down)
insertLanguage (line 215)

method for inserting a language into the system language table system language is messages which is needed outside of the module scope, e.g. menu items.

  • return: false if no language file exists. Else return true.
  • access: public
boolean insertLanguage ([ $module = null])
  • $module
insertMenuItem (line 370)

method for creating the modules main menu items create new row to module register

  • return: true on success false on failure
  • access: public
boolean insertMenuItem ()
install (line 461)

method for installing a module.

checks if module already is installed, if not we install it.

  • return: true on success or false on failure
  • access: public
boolean install (string 0)
  • string 0: name of module to install
isInstalled (line 128)

method for checking if a module is installed or not checking is just done by looking into the modules table of database

  • return: true or false
  • access: public
boolean isInstalled ()
reloadLanguages (line 179)

method to reload all languages gets all modules reloads language files one after another.

  • access: public
void reloadLanguages ()
setInstallInfo (line 79)

reads install info from modules/module_name/install.inc

  • access: public
void setInstallInfo (string $options)
  • string $options: module_name to get info
uninstall (line 561)

method for uninstalling a module

  • return: true on success or false on failure
  • access: public
boolean uninstall ()
upgrade (line 664)

method for upgrading a module

  • return:

    0 if no upgrade $i >= 1 if upgrades were made NOTE that the update of registry is taking place before the actual upgrade of the modules sql. ERROR CODE:

    Error!: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.

    current version is fetched from database new version is found in list of mysql/up files

    if (current version is less than any database version it means we upgrade. We also upgrade modules table in database so we know at which version we are.

    Therefore: Current Version is the version found in the database. If we have downloadéd a more recent version of module then specified in modules table we will examine list of up files. And upgrade to latest.

    Current version should be backed up when downloaded. This will always happen if you use the following script scripts/commands/module.php

    Configuration if we have downloaded a new version and unpacked it there may be new configuration. Therefore remember to look at new config.ini-dist

    You will see if there is any new configuration which needs to be set.

  • see: scripts/commands/module.php
  • access: public
int upgrade ([float $specific = null])
  • float $specific: if $specific_version isset, then only upgrade to this version
upgradeAll (line 199)

method for upgrading all modules.

Not used for now.

  • access: public
void upgradeAll ()

Inherited Methods

Inherited From db

db::__construct()
db::connect()
db::delete()
db::fatalError()
db::getDebug()
db::getNumRows()
db::insert()
db::prepareToPost()
db::rawQuery()
db::select()
db::selectAll()
db::selectOne()
db::selectQuery()
db::simpleSearch()
db::simpleSearchCount()
db::update()

Documentation generated on Fri, 17 Dec 2010 17:56:36 +0100 by phpDocumentor 1.4.3