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

Install items and handlers

What an install item in package.xml is, how the kernel finds the handler for it through package.ini HandlerAlias, what each shipped handler (ezcontentclass, ezcontentobject, ezextension, ezfile, ezsql, eziniaddon…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/site-packages/basics/install-items-and-handlers.md

On this page

Install items and handlers

This page is for developers who read or write the <install> part of a package, and for administrators who want to know what an install will do to a site. It answers: what an install item is, which code runs it, and what each handler changes.

Contents

  1. Install items
  2. How a handler is found
  3. The shipped handlers
  4. What happens to one item
  5. Conflicts: an item that meets something existing
  6. Handlers in the setup wizard and in ezpm
  7. The step installers of the administration
  8. Related pages

Install items

An install item is one <item> of the <install> list in package.xml:

<install>
  <item type="ezcontentclass" filename="class-article" sub-directory="ezcontentclass"/>
  <item type="ezcontentobject" filename="contentobjects" sub-directory="ezcontentobject"/>
  <item type="ezextension" filename="extension-ezwebin" sub-directory="ezextension"/>
  <item type="ezfile" collection="default"/>
</install>

type names the handler. sub-directory and filename name the item's document, <package>/<sub-directory>/<filename>.xml. The <uninstall> list has the same form. Items run in the order they are listed; eZPackage::installUnaudited() skips an item whose type, filename and sub-directory repeat an earlier one.

How a handler is found

eZPackage::packageHandler( $type ) looks the type up in settings/package.ini:

[PackageSettings]
HandlerAlias[ezcontentclass]=eZContentClassPackageHandler
HandlerAlias[ezcontentobject]=eZContentObjectPackageHandler
HandlerAlias[eziniaddon]=eZINIAddonPackageHandler
HandlerAlias[ezfile]=eZFilePackageHandler
HandlerAlias[ezini]=eZFilePackageHandler
HandlerAlias[ezdesign]=eZFilePackageHandler
HandlerAlias[eztemplate]=eZFilePackageHandler
HandlerAlias[ezthumbnail]=eZFilePackageHandler
HandlerAlias[ezsql]=eZDBPackageHandler
HandlerAlias[ezextension]=eZExtensionPackageHandler
HandlerAlias[ezinstallscript]=eZInstallScriptPackageHandler

The class is created through eZExtension::getHandlerClass() and kept for the request. A type without an entry has no handler: the install of that item fails with "No package handler found for install item type '...'". Because this is an INI array, another handler can be registered with a further HandlerAlias[<type>]=<class> entry in an override or an extension's package.ini.append.php; the class must extend eZPackageHandler (kernel/classes/ezpackagehandler.php).

The shipped handlers

Item typeHandlerFolderInstallUninstall
ezcontentclasseZContentClassPackageHandlerkernel/classes/packagehandlers/ezcontentclass/Creates the class from its document, with its attributes, in its class groups. An identifier that is taken gets _1, _2 ...Removes the class matched by remote ID, after a confirmation when objects of it exist
ezcontentobjecteZContentObjectPackageHandler.../ezcontentobject/Creates the objects listed in contentobjects.xml (<object-files-list>, one object-<remote id>.xml each) below the top nodes, then installs templates, overrides and fetch aliases the document carriesRemoves the objects
ezextensioneZExtensionPackageHandler.../ezextension/Copies <sub-directory>/<name>/ to extension/<name>/, regenerates the extension autoloads and adds the name to ActiveExtensions[] in settings/override/site.ini.append.phpDeletes extension/<name>/, removes it from ActiveExtensions[], regenerates the autoloads
ezfile, ezini, ezdesign, eztemplate, ezthumbnaileZFilePackageHandler.../ezfile/Copies every file of the item's collection to its place: design/<design>/templates, images, stylesheets, fonts; settings/[override/][siteaccess/<name>/]; or a plain path. Thumbnails are not copied. INI files can get variables setfrom 6.0.15 on: removes the files its install created and nobody changed since (see the note below)
ezsqleZDBPackageHandler.../ezdb/Runs sql/[<database-type>/]<filename> through eZDB::insertFile(); with a database-type of another engine than the current one the file is not run and the item returns failurenothing: SQL cannot be reversed; the item counts as not uninstalled
eziniaddoneZINIAddonPackageHandler.../eziniaddon/Writes INI blocks of a siteaccess, turning remote IDs into the IDs of this sitenothing: the blocks stay; the item counts as not uninstalled
ezinstallscripteZInstallScriptPackageHandler.../ezinstallscript/Nothing: returns success. The script is run by a step installer (below)nothing

The files differ in what they read: ezcontentclass, ezcontentobject, ezextension and eziniaddon read the item's document before install() is called (extractInstallContent()), the others do not.

Note

Before 6.0.15, eZFilePackageHandler, eZDBPackageHandler and eZINIAddonPackageHandler had no uninstall() of their own: the base method did nothing and returned no value, which eZPackage::uninstall() counted as an item that did not uninstall, and files, SQL and INI changes stayed on the site. From 6.0.15 on:

  • eZFilePackageHandler::uninstall() removes a file only when its install created it (it did not exist before; the install remembers it in the install data as installed_files), its path is relative and inside the installation, its content is unchanged since, and that content is one of the package's own files. Everything else stays: a file the install replaced, a file the site changed, an INI file that got variables at install time, and the directories. A package installed before 6.0.15 has nothing remembered, so nothing is removed.
  • eZDBPackageHandler and eZINIAddonPackageHandler have an uninstall() that changes nothing and says why in the debug output: SQL cannot be reversed automatically, and INI blocks may hold the site's own values since. The item still counts as not uninstalled; remove those changes by hand.

What happens to one item

eZPackage::installItem() does this for every item:

  1. Find the handler; fail when there is none.
  2. When the handler extracts content, read <sub-directory>/<filename>.xml (or its .json twin); fail when it cannot be read.
  3. Open a database transaction.
  4. Call the handler's install() with the package, the item and the install parameters.
  5. Commit on success; roll back when the handler returns false, leaves the transaction invalid, or throws.

The whole package fails at the first failing item unless the install parameters say continue-on-error. A package whose items all succeeded is recorded as installed in the ezpackage table (name, <number>-<release>, date). What the handlers remember for the uninstall is kept as install data (<install-data>).

Conflicts: an item that meets something existing

Handlers report a conflict through $installParameters['error'] with a code, a description and the actions a person may choose. The administration's install page shows them; the choice can be remembered for the rest of the run.

HandlerConflictActions offered
ezcontentclassA class with the same remote ID existsReplace (with a warning about the objects that go with it), Update existing class (attributes added and updated, none removed), Skip, Keep existing and create a new one
ezextensionextension/<name>/ existsReplace extension, Skip
ezextensionThe name is not a valid extension namenone: the item fails

With non-interactive set, nobody can answer, so a handler takes its non-interactive branch: ezcontentclass skips a class that exists ("Non-interactive installs (e.g. CLI) must not destructively replace existing classes"), while ezextension replaces an existing extension directory.

Handlers in the setup wizard and in ezpm

The Create sites step installs each required package with these parameters (kernel/setup/steps/ezstep_create_sites.php):

array( 'use_dates_from_package' => true,
       'site_access_map' => array( '*' => $userSiteaccessName ),
       'top_nodes_map' => array( '*' => 2 ),
       'design_map' => array( '*' => $userDesignName ),
       'language_map' => $languageMap,
       'restore_dates' => true,
       'user_id' => $user->attribute( 'contentobject_id' ),
       'non-interactive' => true );

ezpm install uses the same kind of map with the siteaccess of the run and top node 2 (or the destination node given), also non-interactive. Both therefore skip classes that exist and replace extensions that exist.

The step installers of the administration

Beside the handlers, settings/package.ini [InstallerSettings] names step installers for the administration's install page:

[InstallerSettings]
HandlerList[]=ezcontentobject
HandlerList[]=ezinstallscript
HandlerAlias[ezcontentobject]=eZContentObjectPackageInstaller
HandlerAlias[ezinstallscript]=eZInstallScriptPackageInstaller
InstallBatchMaxItems=12
InstallBatchTimeBudgetSeconds=6

They live in kernel/classes/packageinstallers/ and add pages to the install (for example, choosing where content goes). InstallBatchMaxItems and InstallBatchTimeBudgetSeconds split a long install into batches; see package installer batching.

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