Post-installation Scripts | Core components |
Post-installation Scripts | |
PEAR Manual | |
The post-install script class must contain two methods, one named init(), and the other named run(). The init() method is called at the same time as all other post-install scripts. The run() method is called at the conclusion of each parameter group in order to process the user's responses to queries.
void init (
PEAR_Config $config
, PEAR_PackageFile_v2 $self
, string|null $lastInstalledVersion
)
The current configuration used for installation.
The package.xml contents as abstracted by this object.
The last version of this package that was installed. This is a very important parameter, as it is the only way to determine whether a package is being installed from scratch, or upgraded from a previous version. Using this parameter, it is possible to determine what incremental changes, if any, need to be performed.
bool run (
array $infoArray
, string $paramGroupId
)
if $paramGroupId is _undoOnError, then $infoArray will contain a list of successfully completed parameter group sections. This can be used to restore any system changes made by the installation script.
Otherwise, $infoArray contains the results of the user input from the most recent <paramgroup> section.
This variable either contains _undoOnError or the contents of the most recent <paramgroup>'s <id> tag. Note that paramgroup id cannot begin with an underscore (_), and so _undoOnError can only be triggered by the PEAR installer.
Post-installation Scripts | Core components |
Post-installation Scripts | |
PEAR Manual | |