Jelix 1.8.14-pre

jInstallerModule
in package
implements jIInstallerComponent

A class that does processing to configure and install a module into an application. A module should have a class that inherits from it in order to configure itself into the application.

Tags
subpackage

installer

since
1.2
deprecated

Interfaces, Classes and Traits

jIInstallerComponent

Table of Contents

$componentName  : string
$date  : string
$name  : string
$targetVersions  : array<string|int, mixed>
the versions for which the installer should be called.
$version  : string
$config  : MultiIniModifier
combination between mainconfig.ini.php (master) and entrypoint config (overrider).
$contextId  : mixed
$dbProfile  : string
$defaultDbProfile  : string
$entryPoint  : jInstallerEntryPoint
the entry point property on which the installer is called.
$installWholeApp  : bool
$newContextId  : mixed
$parameters  : array<string|int, mixed>
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.
$_dbConn  : jDbConnection
$newEntrypoints  : array<string|int, mixed>
list of new entrypoints.
__construct()  : mixed
createEntryPoint()  : mixed
declarePluginsPath()  : mixed
Before Jelix 1.7, it allowed to declare a plugins directory.
getContexts()  : mixed
getDate()  : mixed
getName()  : mixed
getNewEntrypoints()  : array<string|int, mixed>
getParameter()  : mixed
getTargetVersions()  : mixed
getVersion()  : mixed
initDbProfile()  : mixed
internal use.
install()  : mixed
should configure the module, install table into the database etc.. If an error occurs during the installation, you are responsible to cancel/revert all things the method did before the error.
postInstall()  : mixed
Redefine this method if you do some additionnal process after the installation of all other modules (dependents modules or the whole application).
postUninstall()  : mixed
preInstall()  : mixed
Called before the installation of all other modules (dependents modules or the whole application).
preUninstall()  : mixed
Called before the uninstallation of all other modules (dependents modules or the whole application).
setContext()  : mixed
setEntryPoint()  : mixed
is called to indicate that the installer will be called for the given configuration, entry point and db profile.
setParameters()  : mixed
setTargetVersions()  : mixed
setVersion()  : mixed
uninstall()  : mixed
should remove static files. Probably remove some data if the user is agree etc.
updateEntryPointFile()  : mixed
copyDirectoryContent()  : mixed
copy the whole content of a directory existing in the install/ directory of the component, to the given directory.
copyFile()  : mixed
copy a file from the install/ directory to an other.
dbConnection()  : jDbConnection
dbTool()  : jDbTools
declareDbProfile()  : bool
declare a new db profile. if the content of the section is not given, it will declare an alias to the default profile.
execSQLScript()  : mixed
import a sql script into the current profile.
expandPath()  : mixed
firstConfExec()  : mixed
firstDbExec()  : mixed
firstExec()  : mixed
getDbType()  : string
updateOrCreateEntryPointFile()  : mixed
useDbProfile()  : mixed
use the given database profile. check if this is an alias and use the real db profiel if this is the case.

Properties

$date

public string $date = ''

the date of the release of the update. format: yyyy-mm-dd hh:ii

Tags
since
1.2.6

$targetVersions

the versions for which the installer should be called.

public array<string|int, mixed> $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).

list of version by asc order

Tags
since
1.2.6

$config

combination between mainconfig.ini.php (master) and entrypoint config (overrider).

protected MultiIniModifier $config
Tags
deprecated

use entryPoint methods to access to different configuration files

$defaultDbProfile

protected string $defaultDbProfile = ''

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

Tags

$installWholeApp

protected bool $installWholeApp = \false

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.

Tags
deprecated

$parameters

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

protected array<string|int, mixed> $parameters = array()
Tags

$newEntrypoints

list of new entrypoints.

private array<string|int, mixed> $newEntrypoints = array()

keys are ep id, value are array with 'file', 'config', 'type' keys

Tags

Methods

__construct()

public __construct(string $componentName, string $name, string $path, string $version[, bool $installWholeApp = false ]) : mixed
Parameters
$componentName : string

name of the component

$name : string

name of the installer

$path : string

the component path

$version : string

version of the component

$installWholeApp : bool = false

true if the installation is during the whole app installation false if it is only few modules and this module. deprecated.

Tags
Return values
mixed

createEntryPoint()

public createEntryPoint(string $entryPointFile, string $configurationFile[, string $targetConfigDirName = '' ][, string $type = 'classic' ]) : mixed
Parameters
$entryPointFile : string

path to the entrypoint file to copy, from the install directory

$configurationFile : string

path to the configuration file of the entrypoint to copy, from the install directory

$targetConfigDirName : string = ''

directory name into var/config where to copy the configuration file. by default, the directory name is the entrypoint name.

$type : string = 'classic'

type of the entrypoint

Tags
Return values
mixed

declarePluginsPath()

Before Jelix 1.7, it allowed to declare a plugins directory.

public declarePluginsPath(string $path) : mixed

Starting from 1.7, it does nothing as plugins path are declared at runtime. This method is still here to avoid PHP errors

Parameters
$path : string

a path. it could contains aliases like 'app:', 'lib:' or 'module:'

Tags
deprecated
Return values
mixed

getNewEntrypoints()

public getNewEntrypoints() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getParameter()

public getParameter(mixed $name) : mixed
Parameters
$name : mixed
Tags
Return values
mixed

initDbProfile()

internal use.

public initDbProfile(string $dbProfile) : mixed
Parameters
$dbProfile : string

the name of the current jdb profile. It will be replaced by $defaultDbProfile if it exists

Tags
Return values
mixed

install()

should configure the module, install table into the database etc.. If an error occurs during the installation, you are responsible to cancel/revert all things the method did before the error.

public install() : mixed
Tags
throws
Exception

if an error occurs during the installation

Return values
mixed

postInstall()

Redefine this method if you do some additionnal process after the installation of all other modules (dependents modules or the whole application).

public postInstall() : mixed
Tags
throws
Exception

if an error occurs during the post installation

Return values
mixed

postUninstall()

public postUninstall() : mixed
Tags
throws
Exception

if an error occurs during the install

Return values
mixed

preInstall()

Called before the installation of all other modules (dependents modules or the whole application).

public preInstall() : mixed

Here, you should check if the module can be installed or not.

Tags
throws
Exception

if the module cannot be installed

Return values
mixed

preUninstall()

Called before the uninstallation of all other modules (dependents modules or the whole application).

public preUninstall() : mixed

Here, you should check if the module can be uninstalled or not.

Tags
throws
Exception

if the module cannot be uninstalled

Return values
mixed

setContext()

public setContext(array<string|int, mixed> $contexts) : mixed
Parameters
$contexts : array<string|int, mixed>

list of contexts already executed

Tags
Return values
mixed

setEntryPoint()

is called to indicate that the installer will be called for the given configuration, entry point and db profile.

public setEntryPoint(jInstallerEntryPoint $ep, string $dbProfile) : mixed
Parameters
$ep : jInstallerEntryPoint

the entry point

$dbProfile : string

the name of the current jdb profile. It will be replaced by $defaultDbProfile if it exists

Tags
Return values
mixed

setParameters()

public setParameters(mixed $parameters) : mixed
Parameters
$parameters : mixed
Tags
Return values
mixed

setTargetVersions()

public setTargetVersions(mixed $versions) : mixed
Parameters
$versions : mixed
Tags
Return values
mixed

setVersion()

public setVersion(mixed $version) : mixed
Parameters
$version : mixed
Tags
Return values
mixed

uninstall()

should remove static files. Probably remove some data if the user is agree etc.

public uninstall() : mixed

..

Tags
throws
Exception

if an error occurs during the install

Return values
mixed

updateEntryPointFile()

public updateEntryPointFile(string $entryPointFile) : mixed
Parameters
$entryPointFile : string

path to the entrypoint file to copy, from the install directory

Tags
Return values
mixed

copyDirectoryContent()

copy the whole content of a directory existing in the install/ directory of the component, to the given directory.

protected final copyDirectoryContent(string $relativeSourcePath, string $targetPath[, mixed $overwrite = false ]) : mixed
Parameters
$relativeSourcePath : string

relative path to the install/ directory of the component

$targetPath : string

the full path where to copy the content

$overwrite : mixed = false
Tags
Return values
mixed

copyFile()

copy a file from the install/ directory to an other.

protected final copyFile(string $relativeSourcePath, string $targetPath[, mixed $overwrite = false ]) : mixed
Parameters
$relativeSourcePath : string

relative path to the install/ directory of the file to copy

$targetPath : string

the full path where to copy the file

$overwrite : mixed = false
Tags
Return values
mixed

declareDbProfile()

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|array<string|int, mixed>|string $sectionContent = null ][, bool $force = true ]) : bool
Parameters
$name : string

the name of the new section/alias

$sectionContent : null|array<string|int, mixed>|string = null

the content of the new section, or null to create an alias

$force : bool = true

true:erase the existing profile

Tags
Return values
bool

true if the ini file has been changed

execSQLScript()

import a sql script into the current profile.

protected final execSQLScript(string $name[, string $module = null ][, bool $inTransaction = true ]) : mixed

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.

Parameters
$name : string

the name of the script

$module : string = null

the module from which we should take the sql file. null for the current module

$inTransaction : bool = true

indicate if queries should be executed inside a transaction

Tags
throws
Exception
Return values
mixed

expandPath()

protected expandPath(mixed $path) : mixed
Parameters
$path : mixed
Tags
Return values
mixed

firstConfExec()

protected firstConfExec([mixed $config = '' ]) : mixed
Parameters
$config : mixed = ''
Tags
Return values
mixed

firstDbExec()

protected firstDbExec([mixed $profile = '' ]) : mixed
Parameters
$profile : mixed = ''
Tags
Return values
mixed

firstExec()

protected firstExec(mixed $contextId) : mixed
Parameters
$contextId : mixed
Tags
Return values
mixed

getDbType()

protected getDbType([string $profile = null ]) : string
Parameters
$profile : string = null

the db profile

Tags
Return values
string

the name of the type of database

updateOrCreateEntryPointFile()

protected updateOrCreateEntryPointFile(mixed $entryPointFile, mixed $epPath) : mixed
Parameters
$entryPointFile : mixed
$epPath : mixed
Tags
Return values
mixed

useDbProfile()

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) : mixed
Parameters
$dbProfile : string

the profile name

Tags
Return values
mixed

Search results