search hotlink icon profile hotlink icon

Internally, the metadata representing and describing the package consists of a monolithic data structure with sequential and associative entries. This page explains the schema of the optional lifecycle part of these entries.

On This Page

Copy

The optional copy entry contains a PHP file relative to own package root, starting with a leading forward slash, such as:

                $metadata["lifecycle"]["copy"] = "/lifecycle/copy.php";
            

The content of the file is a custom on-copy callback script that is executed by the stack task after the entire new state has been stacked in the cache directory and the associated package has been recycled by copying it from the currently existing internal state.

The script may have debug serializer output, such as:

                echo "debug log message";
            

The script may trigger a default PHP error, warning, or notice, such as:

                trigger_error("message", E_USER_ERROR);
            

After successful execution, the script returns the boolean indicator true if something is done or false if nothing is done, such as:

                return true;
            

Download

The optional download entry contains a PHP file relative to own package root, starting with a leading forward slash, such as:

                $metadata["lifecycle"]["download"] = "/lifecycle/download.php";
            

The content of the file is a custom on-download callback script that is executed by the stack task after the entire new state has been stacked in the cache directory and the associated package has been downloaded from a remote source.

The script may have debug serializer output, such as:

                echo "debug log message";
            

The script may trigger a default PHP error, warning, or notice, such as:

                trigger_error("message", E_USER_ERROR);
            

After successful execution, the script returns the boolean indicator true if something is done or false if nothing is done, such as:

                return true;
            

Install

The optional install entry contains a PHP file relative to own package root, starting with a leading forward slash, such as:

                $metadata["lifecycle"]["install"] = "/lifecycle/install.php";
            

The content of the file is a custom on-install callback script that is executed by the shift task after the entire new state has been moved from the cache directory to the current working directory and the associated package has been downloaded from a remote source.

The script may have debug serializer output, such as:

                echo "debug log message";
            

The script may trigger a default PHP error, warning, or notice, such as:

                trigger_error("message", E_USER_ERROR);
            

After successful execution, the script returns the boolean indicator true if something is done or false if nothing is done, such as:

                return true;
            

Update

The optional update entry contains a PHP file relative to own package root, starting with a leading forward slash, such as:

                $metadata["lifecycle"]["update"] = "/lifecycle/update.php";
            

The content of the file is a custom on-update callback script that is executed by the shift task after the entire new state has been moved from the cache directory to the current working directory and the associated package has been recycled by copying it from the previous existing internal state.

The script may have debug serializer output, such as:

                echo "debug log message";
            

The script may trigger a default PHP error, warning, or notice, such as:

                trigger_error("message", E_USER_ERROR);
            

After successful execution, the script returns the boolean indicator true if something is done or false if nothing is done, such as:

                return true;
            

Migrate

The optional migrate entry contains a PHP file relative to own package root, starting with a leading forward slash, such as:

                $metadata["lifecycle"]["migrate"] = "/lifecycle/migrate.php";
            

The content of the file is a custom on-migrate callback script that is executed by the copy task during the internal package recycling process and there are two versions of the package. The current internal and the downloaded external inside the cache directory.

The script of the higher package version may migrate the content from or to the lower version using the following passed variables:

                // lower version package variables
// absolute cache or working directory and
// inline version 
$dir;
$version;
            

The script may have debug serializer output, such as:

                echo "debug log message";
            

The script may trigger a default PHP error, warning, or notice, such as:

                trigger_error("message", E_USER_ERROR);
            

After successful execution, the script returns the boolean indicator true if something is done or false if nothing is done, such as:

                // nothing done
// use the default migration for this version
return false;
            

By default, if no custom callback script is available or if it returns the false indicator, the copy task tries to migrate the extension content itself if one of the following conditions is met:

Delete

The optional delete entry contains a PHP file relative to own package root, starting with a leading forward slash, such as:

                $metadata["lifecycle"]["delete"] = "/lifecycle/delete.php";
            

The content of the file is a custom on-delete callback script that is executed by the shift task during cleanup before the entire new state is moved from the cache directory to the current working directory and the associated package is obsolete.

The script may have debug serializer output, such as:

                echo "debug log message";
            

The script may trigger a default PHP error, warning, or notice, such as:

                trigger_error("message", E_USER_ERROR);
            

After successful execution, the script returns the boolean indicator true if something is done or false if nothing is done, such as:

                return true;