PHP Class Jelix\Installer\AbstractInstaller

Since: 1.2
Exibir arquivo Open project: jelix/jelix

Public Properties

Property Type Description
$date the date of the release of the update. format: yyyy-mm-dd hh:ii
$name name of the installer
$targetVersions array Useful for an upgrade which target multiple branches of a project. Put the version for multiple branches. The installer will be called only once, for the needed version. If you don't fill it, the name of the class file should contain the target version (deprecated behavior though)
$version the version for which the installer is called

Protected Properties

Property Type Description
$componentName name of the component
$config Jelix\IniFile\MultiIniModifier combination between mainconfig.ini.php (master) and entrypoint config (overrider)
$contextId
$dbProfile the jDb profile for the component
$defaultDbProfile the default profile name for the component, if it exist. keep it to '' if not
$entryPoint EntryPoint the entry point property on which the installer is called
$installWholeApp true if this is an installation for the whole application. false if this is an installation in an already installed application. Always False for upgraders.
$newContextId
$parameters array parameters for the installer, indicated in the configuration file or dynamically, by a launcher in a command line for instance.
$path string The path of the module

Public Methods

Method Description
__construct ( string $componentName, string $name, string $path, string $version, boolean $installWholeApp = false )
getConfigIni ( ) : Jelix\IniFile\MultiIniModifier the entry point config combined with $localConfigIni
getContexts ( )
getLocalConfigIni ( ) : Jelix\IniFile\MultiIniModifier the localconfig.ini.php file combined with $mainConfigIni
getMainConfigIni ( ) : Jelix\IniFile\MultiIniModifier the mainconfig.ini.php file combined with defaultconfig.ini.php
getParameter ( $name )
setEntryPoint ( EntryPoint $ep, string $dbProfile, array $contexts ) is called to indicate that the installer will be called for the given configuration, entry point and db profile.
setParameters ( $parameters )

Protected Methods

Method Description
copyDirectoryContent ( string $relativeSourcePath, string $targetPath, $overwrite = false ) copy the whole content of a directory existing in the install/ directory of the component, to the given directory
copyFile ( string $relativeSourcePath, string $targetPath, $overwrite = false ) copy a file from the install/ directory to an other
dbConnection ( ) : jDbConnection
dbTool ( ) : jDbTools
declareDbProfile ( string $name, null | string | array $sectionContent = null, boolean $force = true ) : boolean declare a new db profile. if the content of the section is not given, it will declare an alias to the default profile
declareNewEntryPoint ( $epId, $epType, $configFileName )
execSQLScript ( string $name, string $module = null, boolean $inTransaction = true ) import a sql script into the current profile.
expandPath ( $path )
firstConfExec ( $config = '' )
firstDbExec ( $profile = '' )
firstExec ( $contextId )
getDbType ( string $profile = null ) : string
useDbProfile ( string $dbProfile ) use the given database profile. check if this is an alias and use the real db profiel if this is the case.

Private Methods

Method Description
_copyDirectoryContent ( string $sourcePath, string $targetPath, $overwrite ) private function which copy the content of a directory to an other

Method Details

__construct() public method

public __construct ( string $componentName, string $name, string $path, string $version, boolean $installWholeApp = false )
$componentName string name of the component
$name string name of the installer
$path string the component path
$version string version of the component
$installWholeApp boolean true if the installation is during the whole app installation false if it is only few modules and this module

copyDirectoryContent() final protected method

copy the whole content of a directory existing in the install/ directory of the component, to the given directory
final protected copyDirectoryContent ( string $relativeSourcePath, string $targetPath, $overwrite = false )
$relativeSourcePath string relative path to the install/ directory of the component
$targetPath string the full path where to copy the content

copyFile() final protected method

copy a file from the install/ directory to an other
final protected copyFile ( string $relativeSourcePath, string $targetPath, $overwrite = false )
$relativeSourcePath string relative path to the install/ directory of the file to copy
$targetPath string the full path where to copy the file

dbConnection() protected method

protected dbConnection ( ) : jDbConnection
return jDbConnection the connection to the database used for the module

dbTool() protected method

protected dbTool ( ) : jDbTools
return jDbTools the tool class of jDb

declareDbProfile() protected method

declare a new db profile. if the content of the section is not given, it will declare an alias to the default profile
protected declareDbProfile ( string $name, null | string | array $sectionContent = null, boolean $force = true ) : boolean
$name string the name of the new section/alias
$sectionContent null | string | array the content of the new section, or null to create an alias.
$force boolean true:erase the existing profile
return boolean true if the ini file has been changed

declareNewEntryPoint() protected method

protected declareNewEntryPoint ( $epId, $epType, $configFileName )

execSQLScript() final protected method

The name of the script should be store in install/$name.databasetype.sql in the directory of the component. (replace databasetype by mysql, pgsql etc.) You can however provide a script compatible with all databases, but then you should indicate the full name of the script, with a .sql extension.
final protected execSQLScript ( string $name, string $module = null, boolean $inTransaction = true )
$name string the name of the script
$module string the module from which we should take the sql file. null for the current module
$inTransaction boolean indicate if queries should be executed inside a transaction

expandPath() protected method

protected expandPath ( $path )

firstConfExec() protected method

protected firstConfExec ( $config = '' )

firstDbExec() protected method

protected firstDbExec ( $profile = '' )

firstExec() protected method

protected firstExec ( $contextId )

getConfigIni() public method

the entry point config combined with $localConfigIni
Since: 1.7
public getConfigIni ( ) : Jelix\IniFile\MultiIniModifier
return Jelix\IniFile\MultiIniModifier

getContexts() public method

public getContexts ( )

getDbType() protected method

protected getDbType ( string $profile = null ) : string
$profile string the db profile
return string the name of the type of database

getLocalConfigIni() public method

the localconfig.ini.php file combined with $mainConfigIni
Since: 1.7
public getLocalConfigIni ( ) : Jelix\IniFile\MultiIniModifier
return Jelix\IniFile\MultiIniModifier

getMainConfigIni() public method

the mainconfig.ini.php file combined with defaultconfig.ini.php
Since: 1.7
public getMainConfigIni ( ) : Jelix\IniFile\MultiIniModifier
return Jelix\IniFile\MultiIniModifier

getParameter() public method

public getParameter ( $name )

setEntryPoint() public method

is called to indicate that the installer will be called for the given configuration, entry point and db profile.
public setEntryPoint ( EntryPoint $ep, string $dbProfile, array $contexts )
$ep EntryPoint the entry point
$dbProfile string the name of the current jdb profile. It will be replaced by $defaultDbProfile if it exists
$contexts array list of contexts already executed

setParameters() public method

public setParameters ( $parameters )

useDbProfile() protected method

use the given database profile. check if this is an alias and use the real db profiel if this is the case.
protected useDbProfile ( string $dbProfile )
$dbProfile string the profile name

Property Details

$componentName protected_oe property

name of the component
protected $componentName

$config protected_oe property

combination between mainconfig.ini.php (master) and entrypoint config (overrider)
Deprecation: use entryPoint methods to access to different configuration files.
protected MultiIniModifier,Jelix\IniFile $config
return Jelix\IniFile\MultiIniModifier

$contextId protected_oe property

protected $contextId

$date public_oe property

the date of the release of the update. format: yyyy-mm-dd hh:ii
Since: 1.2.6
public $date

$dbProfile protected_oe property

the jDb profile for the component
protected $dbProfile

$defaultDbProfile protected_oe property

the default profile name for the component, if it exist. keep it to '' if not
protected $defaultDbProfile

$entryPoint protected_oe property

the entry point property on which the installer is called
protected EntryPoint,Jelix\Installer $entryPoint
return EntryPoint

$installWholeApp protected_oe property

true if this is an installation for the whole application. false if this is an installation in an already installed application. Always False for upgraders.
protected $installWholeApp

$name public_oe property

name of the installer
public $name

$newContextId protected_oe property

protected $newContextId

$parameters protected_oe property

parameters for the installer, indicated in the configuration file or dynamically, by a launcher in a command line for instance.
protected array $parameters
return array

$path protected_oe property

The path of the module
protected string $path
return string

$targetVersions public_oe property

Useful for an upgrade which target multiple branches of a project. Put the version for multiple branches. The installer will be called only once, for the needed version. If you don't fill it, the name of the class file should contain the target version (deprecated behavior though)
Since: 1.2.6
public array $targetVersions
return array

$version public_oe property

the version for which the installer is called
public $version