Open Journal Systems  3.3.0
Installer Class Reference
Inheritance diagram for Installer:
PKPInstall Install

Public Member Functions

 __construct ($descriptor, $params=array(), $isPlugin=false)
 
 abort ($installer, $attr)
 
 addInstallAction ($node)
 
 addPluginVersions ()
 
 checkPhpVersion ()
 
 clearDataCache ()
 
 columnExists ($tableName, $columnName)
 
 destroy ()
 
 execute ()
 
 executeAction ($action)
 
 executeInstaller ()
 
 executeSQL ($sql)
 
 fixLibraryFiles ()
 
 getConfigContents ()
 
 getCurrentVersion ()
 
 getErrorMsg ()
 
 getErrorString ()
 
 getErrorType ()
 
 getNewVersion ()
 
 getNotes ()
 
 getParam ($name)
 
 getSQL ()
 
 installDefaultNavigationMenus ()
 
 installEmailTemplate ($installer, $attr)
 
 installFilterConfig ($filterConfigFile)
 
 isUpgrade ()
 
 log ($message)
 
 migrateMetadataSettings ()
 
 migrateSidebarBlocks ()
 
 migrateSiteLocales ()
 
 parseInstaller ()
 
 parseInstallNodes ($installTree)
 
 postInstall ()
 
 preInstall ()
 
 setCurrentVersion ($version)
 
 setError ($type, $msg)
 
 setLogger ($logger)
 
 setStatsEmailSettings ()
 
 tableExists ($tableName)
 
 updateConfig ($configParams)
 
 updateVersion ()
 
 wroteConfig ()
 

Data Fields

 $actions
 
 $configContents
 
 $currentVersion
 
 $dataXMLParser
 
 $dbconn
 
 $descriptor
 
 $errorMsg
 
 $errorType
 
 $installedLocales
 
 $isPlugin
 
 $locale
 
 $logger
 
 $migrations = []
 
 $newVersion
 
 $notes
 
 $params
 
 $sql
 
 $wroteConfig
 

Detailed Description

Base class for install and upgrade scripts.

Definition at line 34 of file Installer.inc.php.

Constructor & Destructor Documentation

◆ __construct()

Installer::__construct (   $descriptor,
  $params = array(),
  $isPlugin = false 
)

Constructor.

Parameters
$descriptorstring descriptor path
$paramsarray installer parameters
$isPluginboolean true iff a plugin is being installed

Reimplemented in PKPInstall, and Install.

Definition at line 150 of file Installer.inc.php.

References $descriptor, $isPlugin, $params, HookRegistry\call(), PluginRegistry\loadAllPlugins(), and wroteConfig().

Member Function Documentation

◆ abort()

Installer::abort (   $installer,
  $attr 
)

Fail the upgrade.

Parameters
$installerInstaller
$attrarray Attributes
Returns
boolean

Definition at line 831 of file Installer.inc.php.

◆ addInstallAction()

Installer::addInstallAction (   $node)

Add an installer action from the descriptor.

Parameters
$nodeXMLNode

Definition at line 382 of file Installer.inc.php.

Referenced by parseInstallNodes().

◆ addPluginVersions()

Installer::addPluginVersions ( )

Insert or update plugin data in versions and plugin_settings tables.

Returns
boolean

Definition at line 790 of file Installer.inc.php.

References PluginRegistry\getCategories(), Core\getCurrentDate(), DAORegistry\getDAO(), PluginRegistry\getPlugins(), PluginRegistry\loadCategory(), and VersionCheck\parseVersionXML().

◆ checkPhpVersion()

Installer::checkPhpVersion ( )

Check that the environment meets minimum PHP requirements.

Returns
boolean Success/failure

Definition at line 858 of file Installer.inc.php.

References setError().

◆ clearDataCache()

Installer::clearDataCache ( )

Clear the data cache files (needed because of direct tinkering with settings tables)

Returns
boolean

Definition at line 676 of file Installer.inc.php.

References CACHE_TYPE_FILE, CACHE_TYPE_OBJECT, and CacheManager\getManager().

◆ columnExists()

Installer::columnExists (   $tableName,
  $columnName 
)

Check to see whether a column exists. Used in installer XML in conditional checks on <data> nodes.

Parameters
$tableNamestring
$columnNamestring
Returns
boolean

Definition at line 751 of file Installer.inc.php.

References DAORegistry\getDAO().

◆ destroy()

Installer::destroy ( )

Destroy / clean-up after the installer.

Definition at line 178 of file Installer.inc.php.

References HookRegistry\call().

◆ execute()

Installer::execute ( )

Installation.

Returns
boolean

Definition at line 228 of file Installer.inc.php.

References executeInstaller(), parseInstaller(), postInstall(), preInstall(), and updateVersion().

◆ executeAction()

Installer::executeAction (   $action)

Execute a single installer action.

Parameters
$actionarray
Returns
boolean

Definition at line 416 of file Installer.inc.php.

References $sql, executeSQL(), log(), and setError().

Referenced by executeInstaller().

◆ executeInstaller()

Installer::executeInstaller ( )

Execute the installer actions.

Returns
boolean

Definition at line 316 of file Installer.inc.php.

References HookRegistry\call(), executeAction(), and log().

Referenced by execute().

◆ executeSQL()

Installer::executeSQL (   $sql)

Execute an SQL statement.

Parameters
$sqlmixed
Returns
boolean

Definition at line 516 of file Installer.inc.php.

References $sql, and setError().

Referenced by PKPInstall\createDatabase(), and executeAction().

◆ fixLibraryFiles()

Installer::fixLibraryFiles ( )

Fix library files, which were mistakenly named server-side using source filenames. See https://github.com/pkp/pkp-lib/issues/5471

Returns
boolean

Definition at line 1091 of file Installer.inc.php.

References DAORegistry\getDAO().

◆ getConfigContents()

Installer::getConfigContents ( )

Get the contents of the updated configuration file.

Returns
string

Definition at line 606 of file Installer.inc.php.

References $configContents.

◆ getCurrentVersion()

Installer::getCurrentVersion ( )

Return currently installed version.

Returns
Version

Definition at line 574 of file Installer.inc.php.

References $currentVersion.

◆ getErrorMsg()

Installer::getErrorMsg ( )

The error message, if an error has occurred. In the case of a database error, an unlocalized string containing the error message is returned. For any other error, a localization key for the error message is returned.

Returns
string

Definition at line 636 of file Installer.inc.php.

References $errorMsg.

Referenced by getErrorString().

◆ getErrorString()

Installer::getErrorString ( )

Return the error message as a localized string.

Returns
string.

Definition at line 644 of file Installer.inc.php.

References getErrorMsg(), and getErrorType().

◆ getErrorType()

Installer::getErrorType ( )

Return the error code. Valid return values are:

  • 0 = no error
  • INSTALLER_ERROR_GENERAL = general installation error.
  • INSTALLER_ERROR_DB = database installation error
    Returns
    int

Definition at line 626 of file Installer.inc.php.

Referenced by getErrorString(), and parseInstaller().

◆ getNewVersion()

Installer::getNewVersion ( )

Return new version after installation.

Returns
Version

Definition at line 582 of file Installer.inc.php.

References $newVersion.

◆ getNotes()

Installer::getNotes ( )

Get the set of installation notes.

Returns
array

Definition at line 598 of file Installer.inc.php.

References $notes.

◆ getParam()

Installer::getParam (   $name)

Get the value of an installation parameter.

Parameters
$name
Returns
mixed

Definition at line 566 of file Installer.inc.php.

Referenced by PKPInstall\createConfig(), PKPInstall\createData(), PKPInstall\createDatabase(), PKPInstall\createDirectories(), and PKPInstall\preInstall().

◆ getSQL()

Installer::getSQL ( )

Get the set of SQL statements required to perform the install.

Returns
array

Definition at line 590 of file Installer.inc.php.

References $sql.

◆ installDefaultNavigationMenus()

Installer::installDefaultNavigationMenus ( )

For 3.1.0 upgrade. DefaultMenus Defaults

Returns
boolean Success/failure

Definition at line 840 of file Installer.inc.php.

References Application\getContextDAO(), and DAORegistry\getDAO().

◆ installEmailTemplate()

Installer::installEmailTemplate (   $installer,
  $attr 
)

For upgrade: install email templates and data

Parameters
$installerobject
$attrarray Attributes: array containing 'key' => 'EMAIL_KEY_HERE', 'locales' => 'en_US,fr_CA,...'

Definition at line 698 of file Installer.inc.php.

References $locale, DAORegistry\getDAO(), and AppLocale\requireComponents().

◆ installFilterConfig()

Installer::installFilterConfig (   $filterConfigFile)

Install the given filter configuration file.

Parameters
$filterConfigFilestring
Returns
boolean true when successful, otherwise false

Definition at line 711 of file Installer.inc.php.

◆ isUpgrade()

Installer::isUpgrade ( )

Returns true iff this is an upgrade process.

Reimplemented in PKPInstall.

Definition at line 171 of file Installer.inc.php.

◆ log()

Installer::log (   $message)

Record message to installation log.

Parameters
$messagestring

Definition at line 269 of file Installer.inc.php.

Referenced by executeAction(), executeInstaller(), parseInstaller(), postInstall(), and preInstall().

◆ migrateMetadataSettings()

Installer::migrateMetadataSettings ( )

Migrate the metadata settings in the database to use a single row with one of the new constants

Definition at line 955 of file Installer.inc.php.

◆ migrateSidebarBlocks()

Installer::migrateSidebarBlocks ( )

Migrate active sidebar blocks from plugin_settings to journal_settings

Returns
boolean

Definition at line 894 of file Installer.inc.php.

References Application\getContextDAO(), DAORegistry\getDAO(), and PluginRegistry\loadCategory().

◆ migrateSiteLocales()

Installer::migrateSiteLocales ( )

Definition at line 868 of file Installer.inc.php.

References $params, and DAORegistry\getDAO().

◆ parseInstaller()

Installer::parseInstaller ( )

Parse the installation descriptor XML file.

Returns
boolean

Definition at line 284 of file Installer.inc.php.

References $currentVersion, $descriptor, HookRegistry\call(), Version\fromString(), getErrorType(), log(), parseInstallNodes(), and setError().

Referenced by execute().

◆ parseInstallNodes()

Installer::parseInstallNodes (   $installTree)

Parse children nodes in the install descriptor.

Parameters
$installTreeXMLNode

Definition at line 357 of file Installer.inc.php.

References addInstallAction().

Referenced by parseInstaller().

◆ postInstall()

Installer::postInstall ( )

Post-installation.

Returns
boolean

Definition at line 257 of file Installer.inc.php.

References HookRegistry\call(), and log().

Referenced by execute().

◆ preInstall()

Installer::preInstall ( )

Pre-installation.

Returns
boolean

Reimplemented in PKPInstall.

Definition at line 186 of file Installer.inc.php.

References HookRegistry\call(), PKPLocale\getAllLocales(), DAORegistry\getDAO(), DBConnection\getInstance(), AppLocale\getLocale(), log(), and setError().

Referenced by execute().

◆ setCurrentVersion()

Installer::setCurrentVersion (   $version)

Set the current version for this installer.

Parameters
$versionVersion

Definition at line 687 of file Installer.inc.php.

◆ setError()

Installer::setError (   $type,
  $msg 
)

Set the error type and messgae.

Parameters
$typeint
$msgstring Text message (INSTALLER_ERROR_DB) or locale key (otherwise)

Definition at line 658 of file Installer.inc.php.

Referenced by checkPhpVersion(), PKPInstall\createData(), PKPInstall\createDatabase(), PKPInstall\createDirectories(), executeAction(), executeSQL(), parseInstaller(), PKPInstall\preInstall(), preInstall(), and updateConfig().

◆ setLogger()

Installer::setLogger (   $logger)

Set the logger for this installer.

Parameters
$loggerLogger

Definition at line 667 of file Installer.inc.php.

References $logger.

◆ setStatsEmailSettings()

Installer::setStatsEmailSettings ( )

Set the notification settings for journal managers and subeditors so that they are opted out of the monthly stats email.

Definition at line 1055 of file Installer.inc.php.

References PKPApplication\get(), and DAORegistry\getDAO().

◆ tableExists()

Installer::tableExists (   $tableName)

Check to see whether a table exists. Used in installer XML in conditional checks on <data> nodes.

Parameters
$tableNamestring
Returns
boolean

Definition at line 775 of file Installer.inc.php.

References DAORegistry\getDAO().

◆ updateConfig()

Installer::updateConfig (   $configParams)

Update the specified configuration parameters.

Parameters
$configParamsarrays
Returns
boolean

Definition at line 539 of file Installer.inc.php.

References Config\getConfigFileName(), setError(), and wroteConfig().

Referenced by PKPInstall\createConfig().

◆ updateVersion()

Installer::updateVersion ( )

Update the version number.

Returns
boolean

Definition at line 334 of file Installer.inc.php.

References HookRegistry\call(), and DAORegistry\getDAO().

Referenced by execute().

◆ wroteConfig()

Installer::wroteConfig ( )

Check if installer was able to write out new config file.

Returns
boolean

Definition at line 614 of file Installer.inc.php.

References $wroteConfig.

Referenced by __construct(), and updateConfig().

Field Documentation

◆ $actions

array Installer::$actions

installer actions to be performed

Definition at line 94 of file Installer.inc.php.

◆ $configContents

string Installer::$configContents

contents of the updated config file

Definition at line 112 of file Installer.inc.php.

Referenced by getConfigContents().

◆ $currentVersion

Version Installer::$currentVersion

currently installed version

Definition at line 58 of file Installer.inc.php.

Referenced by getCurrentVersion(), and parseInstaller().

◆ $dataXMLParser

DBDataXMLParser Installer::$dataXMLParser

database data parser

Definition at line 88 of file Installer.inc.php.

◆ $dbconn

ADOConnection Installer::$dbconn

database connection

Definition at line 70 of file Installer.inc.php.

◆ $descriptor

string Installer::$descriptor

descriptor path (relative to INSTALLER_DATA_DIR)

Definition at line 40 of file Installer.inc.php.

Referenced by Install\__construct(), __construct(), and parseInstaller().

◆ $errorMsg

string Installer::$errorMsg

the error message, if an installation error has occurred

Definition at line 130 of file Installer.inc.php.

Referenced by getErrorMsg().

◆ $errorType

int Installer::$errorType

error code (null | INSTALLER_ERROR_GENERAL | INSTALLER_ERROR_DB)

Definition at line 124 of file Installer.inc.php.

◆ $installedLocales

string Installer::$installedLocales

available locales

Definition at line 82 of file Installer.inc.php.

◆ $isPlugin

boolean Installer::$isPlugin

indicates if a plugin is being installed (thus modifying the descriptor path)

Definition at line 46 of file Installer.inc.php.

Referenced by Install\__construct(), PKPInstall\__construct(), and __construct().

◆ $locale

string Installer::$locale

default locale

Definition at line 76 of file Installer.inc.php.

Referenced by PKPInstall\createData(), and installEmailTemplate().

◆ $logger

Logger Installer::$logger

logging object

Definition at line 136 of file Installer.inc.php.

Referenced by setLogger().

◆ $migrations

array Installer::$migrations = []

List of migrations executed already

Definition at line 142 of file Installer.inc.php.

◆ $newVersion

Version Installer::$newVersion

version after installation

Definition at line 64 of file Installer.inc.php.

Referenced by getNewVersion().

◆ $notes

array Installer::$notes

installation notes

Definition at line 106 of file Installer.inc.php.

Referenced by getNotes().

◆ $params

array Installer::$params

installation parameters

Definition at line 52 of file Installer.inc.php.

Referenced by Install\__construct(), PKPInstall\__construct(), __construct(), and migrateSiteLocales().

◆ $sql

array Installer::$sql

SQL statements for database installation

Definition at line 100 of file Installer.inc.php.

Referenced by PKPInstall\createDatabase(), executeAction(), executeSQL(), and getSQL().

◆ $wroteConfig

boolean Installer::$wroteConfig

indicating if config file was written or not

Definition at line 118 of file Installer.inc.php.

Referenced by wroteConfig().


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