Pyrus Post-install scripts: differences from PEAR


Post-install scripts (documented here and here) are mostly the same in Pyrus with a few important differences.

The XML format in package.xml is identical, so no change need be made to the <paramgroup> or other tags. The script itself should still follow the naming conventions of PEAR. The only real difference is the naming of methods within the script.

PEAR requires that all post-install scripts implement init(), run() and optionally postProcessPrompts(). Pyrus requires post-install scripts to implement init2(), run2(), and optionally postProcessPrompts2(). This allows PEAR and Pyrus-based post-install scripts to co-exist in the same package without difficulty. Note that post-install scripts must be E_STRICT and E_DEPRECATED compliant, otherwise many PHP warnings will be emitted. One way of handling this issue is to put PHP4 non-E_STRICT-compatible code into a separate file and include it dynamically at run-time. The same should be done for any PHP5+ non-PHP4 compatible code if the post-install script is expected to be able to run in PHP 4.

The init2 method

The init2() method should accept two parameters like so:

function init2($pkg$lastversion)

$pkg is an object representing the package, and $lastversion is the last installed version of the package.

The run2 and postProcessPrompts2 methods

These two methods should accept identical parameters to what the PEAR equivalent accepted. The only reason these are called is to allow easy differentiation between what kind of installer is calling the post-install script.

Pyrus: Improvements from the PEAR Installer (Previous) Pyrus Custom Commands: differences from PEAR (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.