Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,075 of 9,075 pages
About the help in other languages
All help pages

Changing the installer script

How a site package's PHP installer is wired into CreateSites - the settings files, the eZSite* hook functions and when they run, the installer class and its post-install steps, the extensions and tables it sets up - and…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/site-packages/your-own/changing-the-installer-script.md

On this page

Changing the installer script

This page is for developers who change what a site package does when it is installed: which extensions it switches on, which settings and siteaccesses it writes, which roles it creates and which repairs run after the content is in place. It explains how the kernel calls the package's PHP files and how the 7x installer class is built, so you can change a fork without breaking the chain.

7x and the Exponential Foundation strongly encourage you to share the finished package by pull request to se7enxweb/exponential.packages.exponential.earth: see Contribute your site package.

Contents

  1. How the files are loaded
  2. The hook functions
  3. The installer class
  4. Post-install steps
  5. Extensions and their tables
  6. Making a change

How the files are loaded

package.xml lists the installer files in <settings>:

<settings>
  <settings-file filename='ini-site.php'/>
  <settings-file filename='sevenx-multi-site-installer.php'/>
  <settings-file filename='install-scripts.php'/>
  ...
</settings>

During CreateSites, kernel/setup/steps/ezstep_create_sites.php reads the site package's settings-files and runs include_once( <package path>/settings/<file> ) for each file that exists. Nothing else in a file runs by itself: the kernel then calls the hook functions below when they are defined (function_exists()). The same happens whichever front end started the install: the setup wizard, the kickstarter or exp:install (Install scripts in a site package).

The hook functions

In the order ezstep_create_sites.php reaches them:

FunctionDefined in the 7x package byWhat its return value does
eZSitePreInstall( $siteType )install-scripts.phpnothing; runs before the required packages are installed (7x: the installer's preInstall())
eZSiteINISettings( $parameters )ini-site.phpextra settings for the public siteaccess
eZSiteAdminINISettings( $parameters )ini-admin.phpextra settings for the admin siteaccess
eZSiteCommonINISettings( $parameters )ini-common.phpsettings for every siteaccess
eZSiteRoles( $parameters )roles.phpextra roles and policies
eZSitePreferences( $parameters )preferences.phpuser preferences to set
eZSitePostInstall( &$parameters )install-scripts.phpnothing; runs after content, settings and roles (7x: the installer's postInstall())
eZSiteFinalText( $parameters )not used by 7xtext added to the wizard's Finished page

Each 7x hook file is a few lines that create the installer and return one of its methods:

function eZSiteINISettings( $parameters )
{
    $installer = new sevenxMultiSiteInstaller( $parameters );

    return $installer->siteINISettings();
}

Warning

The hook names are global functions. Only one site package is installed per run, but every file you list is included: two files that define the same function end the install with a fatal error.

The installer class

settings/sevenx-multi-site-installer.php defines class sevenxMultiSiteInstaller extends eZSiteInstaller (kernel/classes/ezsiteinstaller.php). Its parts:

PartRole
initSettings( $parameters )collects the values the steps use, with addSetting( name, value ); read back with setting( name )
addSetting( 'extension_list', array( ... ) )the extensions the site switches on, in order (an extension listed earlier wins in settings)
initSteps()fills $this->Steps['post_install'] with the post-install steps
preInstall()work before the packages are installed
siteINISettings(), adminINISettings(), commonINISettings()the settings arrays the hooks return
siteRoles(), sitePreferences()the roles and preferences
solutionName(), solutionExtensionName(), solutionVersion()the names and version the installer records (simple, sevenx_multisite_default_installer, 1.0 in the 7x class)

The class file also loads post-install-fix.php with require_once (repairs shared by the installer); a fork keeps that line pointing at its own copy.

Post-install steps

initSteps() describes the post-install as a list; eZSiteInstaller::postInstall() runs it with executeSteps():

$postInstallSteps = array(
    array( '_function' => 'dbBegin', '_params' => array() ),
    array( '_function' => 'setVersion', '_params' => array() ),
    array( '_function' => 'postInstallFixContentObjectNameLanguages', '_params' => array() ),
    // ...
);
$this->Steps['post_install'] = $postInstallSteps;

Each _function is a method of the installer (yours or one eZSiteInstaller provides) called with _params. When a step reports an error and the error handler answers ERR_ABORT, the rest of the list is skipped and the step is kept in eZSiteInstaller::abortedStep() (number, function, count), so the setup knows the post-install did not finish. The 7x list runs its repairs early for that reason: a comment in initSteps() notes that "executeSteps aborts the chain on the first step that reports an error, and several later steps are fragile".

Tip

Add a new step as a method named postInstall<What>( $params = false ), make it idempotent (safe to run twice), and let it log and continue on data it does not find rather than abort, as the 7x steps do.

Extensions and their tables

Some data a site needs is not content and is not in any package. The 7x installer creates the tables of the extensions it activates and seeds some of them from the extensions' own files: declaredExtensionSchemas() names sevenx_themes_media (schema and data: the layouts, tags and ratings of the demo content), explayouts (schema and data), and the schemas of ezstarrating, ezgmaplocation, eztags, enhancedselection2, cjw_newsletter and syndication; extensionSchemas() adds every other listed extension that ships share/db_schema.dba or sql/<engine>/schema.sql. The details are on Layouts data and share .dba files.

For your fork this means: a layout or tag you want in a new installation goes into the share/db_data.dba of the extension that owns it, not into the site package.

Making a change

  1. Change the method or add a step in your renamed installer class.
  2. Check the syntax: php -l packages/<name>/settings/<your-installer>.php.
  3. Rebuild the archive (Rebuilding with build.sh).
  4. Install it in a sandbox and read var/log/setup.log (Testing in a sandbox).
  5. Write the change in the package's <changelog> and the repository's changelog.

The 7x repository shows the commit style for such changes, for example "Updated: The sevenx_multisite package's installer activates ezownerchange" (15 October 2026).

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x