PHP Class Jelix\Installer\Installer

It load all entry points configurations. Each configurations has its own activated modules. jInstaller then construct a tree dependencies for these activated modules, and launch their installation and the installation of their dependencies. An installation can be an initial installation, or just an upgrade if the module is already installed.
Mostra file Open project: jelix/jelix Class Usage Examples

Public Properties

Property Type Description
$installerIni it represents the installer.ini.php file.
$messages JInstallerMessageProvider
$reporter jIInstallReporter the object responsible of the results output

Protected Properties

Property Type Description
$allModules list of all modules of the application
$entryPoints list of entry point and their properties
$epId identifiant of the entry point is the path+filename of the entry point without the php extension
$localConfig Jelix\IniFile\MultiIniModifier the localconfig.ini.php content combined with $mainConfig
$mainConfig Jelix\IniFile\MultiIniModifier the mainconfig.ini.php combined with the defaultconfig.ini.php
$xmlMapFile Jelix\Routing\UrlMapping\XmlMapModifier

Public Methods

Method Description
__construct ( ReporterInterface $reporter, string $lang = '' ) initialize the installation
forceModuleVersion ( string $moduleName, string $version ) change the module version in readed informations, to simulate an update when we call installApplication or an other method.
getEntryPoint ( string $epId ) : EntryPoint
installApplication ( integer $flags = false ) : boolean install and upgrade if needed, all modules for each entry point. Only modules which have an access property > 0 are installed. Errors appeared during the installation are passed to the reporter.
installEntryPoint ( string $entrypoint ) : boolean install and upgrade if needed, all modules for the given entry point. Only modules which have an access property > 0 are installed. Errors appeared during the installation are passed to the reporter.
installModules ( array $modulesList, string $entrypoint = null ) : boolean install given modules even if they don't have an access property > 0
setModuleParameters ( string $moduleName, array $parameters, string $entrypoint = null ) set parameters for the installer of a module
uninstallModules ( array $modulesList, string $entrypoint = null ) : boolean uninstall given modules

Protected Methods

Method Description
_installModules ( Resolver $resolver, EntryPoint $ep, boolean $installWholeApp, integer $flags = 7 ) : boolean core of the installation
_singleModules ( $action, $modulesList, $entrypoint )
completeInstallStatus ( )
endMessage ( )
error ( $msg, $params = null, $fullString = false )
getEntryPointObject ( $configFile, $file, $type ) : EntryPoint
getInstallerIni ( ) : Jelix\IniFile\IniModifier
notice ( $msg, $params = null, $fullString = false )
ok ( $msg, $params = null, $fullString = false )
readEntryPointsData ( Jelix\Core\Infos\AppInfos $appInfos ) read the list of entrypoint from the project.xml file and read all modules data used by each entry point
resolveDependencies ( Resolver $resolver, $epId )
runInstall ( $componentsToInstall, $ep, $epId, $flags )
runPostInstall ( $installedModules, $ep, $flags )
runPreInstall ( $moduleschain, $ep, $installWholeApp, $flags )
startMessage ( )
warning ( $msg, $params = null, $fullString = false )

Method Details

__construct() public method

it reads configurations files of all entry points, and prepare object for each module, needed to install/upgrade modules.
public __construct ( ReporterInterface $reporter, string $lang = '' )
$reporter ReporterInterface object which is responsible to process messages (display, storage or other..)
$lang string the language code for messages

_installModules() protected method

core of the installation
protected _installModules ( Resolver $resolver, EntryPoint $ep, boolean $installWholeApp, integer $flags = 7 ) : boolean
$resolver Jelix\Dependencies\Resolver
$ep EntryPoint the entrypoint
$installWholeApp boolean true if the installation is done during app installation
$flags integer to know what to do
return boolean true if the installation is ok

_singleModules() protected method

protected _singleModules ( $action, $modulesList, $entrypoint )

completeInstallStatus() protected method

protected completeInstallStatus ( )

endMessage() protected method

protected endMessage ( )

error() protected method

protected error ( $msg, $params = null, $fullString = false )

forceModuleVersion() public method

internal use !!
public forceModuleVersion ( string $moduleName, string $version )
$moduleName string the name of the module
$version string the new version

getEntryPoint() public method

public getEntryPoint ( string $epId ) : EntryPoint
$epId string an entry point id
return EntryPoint the corresponding entry point object

getEntryPointObject() protected method

protected getEntryPointObject ( $configFile, $file, $type ) : EntryPoint
return EntryPoint

getInstallerIni() protected method

protected getInstallerIni ( ) : Jelix\IniFile\IniModifier
return Jelix\IniFile\IniModifier the modifier for the installer.ini.php file

installApplication() public method

install and upgrade if needed, all modules for each entry point. Only modules which have an access property > 0 are installed. Errors appeared during the installation are passed to the reporter.
public installApplication ( integer $flags = false ) : boolean
$flags integer flags indicating if we should install, and/or upgrade modules or only modify config files. internal use. see FLAG_* constants
return boolean true if succeed, false if there are some errors

installEntryPoint() public method

install and upgrade if needed, all modules for the given entry point. Only modules which have an access property > 0 are installed. Errors appeared during the installation are passed to the reporter.
public installEntryPoint ( string $entrypoint ) : boolean
$entrypoint string the entrypoint name as it appears in project.xml
return boolean true if succeed, false if there are some errors

installModules() public method

install given modules even if they don't have an access property > 0
public installModules ( array $modulesList, string $entrypoint = null ) : boolean
$modulesList array array of module names
$entrypoint string the entrypoint name as it appears in project.xml or null if modules should be installed for all entry points
return boolean true if the installation is ok

notice() protected method

protected notice ( $msg, $params = null, $fullString = false )

ok() protected method

protected ok ( $msg, $params = null, $fullString = false )

readEntryPointsData() protected method

read the list of entrypoint from the project.xml file and read all modules data used by each entry point
protected readEntryPointsData ( Jelix\Core\Infos\AppInfos $appInfos )
$appInfos Jelix\Core\Infos\AppInfos

resolveDependencies() protected method

protected resolveDependencies ( Resolver $resolver, $epId )
$resolver Jelix\Dependencies\Resolver

runInstall() protected method

protected runInstall ( $componentsToInstall, $ep, $epId, $flags )

runPostInstall() protected method

protected runPostInstall ( $installedModules, $ep, $flags )

runPreInstall() protected method

protected runPreInstall ( $moduleschain, $ep, $installWholeApp, $flags )

setModuleParameters() public method

set parameters for the installer of a module
public setModuleParameters ( string $moduleName, array $parameters, string $entrypoint = null )
$moduleName string the name of the module
$parameters array parameters
$entrypoint string the entry point name for which parameters will be applied when installing the module. if null, parameters are valid for all entry points

startMessage() protected method

protected startMessage ( )

uninstallModules() public method

uninstall given modules
public uninstallModules ( array $modulesList, string $entrypoint = null ) : boolean
$modulesList array array of module names
$entrypoint string the entrypoint name as it appears in project.xml or null if modules should be uninstalled for all entry points
return boolean true if the uninstallation is ok

warning() protected method

protected warning ( $msg, $params = null, $fullString = false )

Property Details

$allModules protected_oe property

list of all modules of the application
protected $allModules

$entryPoints protected_oe property

list of entry point and their properties
protected $entryPoints

$epId protected_oe property

identifiant of the entry point is the path+filename of the entry point without the php extension
protected $epId

$installerIni public_oe property

it represents the installer.ini.php file.
public $installerIni

$localConfig protected_oe property

the localconfig.ini.php content combined with $mainConfig
protected MultiIniModifier,Jelix\IniFile $localConfig
return Jelix\IniFile\MultiIniModifier

$mainConfig protected_oe property

the mainconfig.ini.php combined with the defaultconfig.ini.php
protected MultiIniModifier,Jelix\IniFile $mainConfig
return Jelix\IniFile\MultiIniModifier

$messages public_oe property

public JInstallerMessageProvider $messages
return JInstallerMessageProvider

$reporter public_oe property

the object responsible of the results output
public jIInstallReporter $reporter
return jIInstallReporter

$xmlMapFile protected_oe property

protected XmlMapModifier,Jelix\Routing\UrlMapping $xmlMapFile
return Jelix\Routing\UrlMapping\XmlMapModifier