Introducing a new way to review your PRs.

Read the announcement

combodo / itop

A simple, web based CMDB & IT Service Management tool

View on GitHub

17 documents · Updated Nov 20, 2026

docs / platform-runtime-and-extensibility

Platform runtime and extensibility

iTop provides a shared runtime that turns one environment's configuration and selected modules into a working application. It loads the model and module code, connects shared services, and gives modules controlled ways to add behavior without taking ownership of the main request flow.

Runtime environment

The runtime environment is the named application state used by a request or setup action. It selects the configuration, compiled module tree, class loading paths, and caches that iTop uses together. The normal environment is production; build environments create runtime data and are not runtime targets (sources/…/StartupService.php• L18-57).

The startup path is shared by the main application and other entry points. It starts the session, selects the environment, loads its configuration, and starts the metamodel. A process can start the metamodel only once, so each process has one active environment (core/metamodel.class.php• L5760-5802).

This diagram shows how a request or setup action becomes a running feature flow.

flowchart TD
    A[Request or setup action] --> B[Select runtime environment]
    B --> C[Load environment configuration]
    C --> D[Load core and module code]
    D --> E[Start metamodel]
    E --> F[Start module and event extensions]
    F --> G[Run feature or setup step]

References: sources/…/StartupService.php• L18-57 core/metamodel.class.php• L5760-5802

Configuration model

The configuration model supplies application-wide and module-specific settings to the runtime. Config starts with typed defaults, reads the selected environment's PHP data file, and checks that the file exists, can be read, and defines the expected settings data (core/config.class.inc.php• L2038-2078, core/config.class.inc.php• L2118-2228).

Configuration values can use environment or server placeholders when placeholder expansion is enabled. The loader resolves these values, including values inside arrays, before it applies the setting type. A missing value without a fallback stops configuration loading (core/config.class.inc.php• L1902-1935, core/config.class.inc.php• L2963-3007, core/config.class.inc.php• L3009-3031).

The configuration file carries general settings, module settings, and legacy add-on includes. Environment values take priority over module defaults declared in module metadata. This gives setup and features one source for database access, logging, security, sessions, limits, cache behavior, and other shared runtime choices. It also carries stable application values used by framework features such as encryption and signed links (core/config.class.inc.php• L1805-1852, core/config.class.inc.php• L2020-2029, core/config.class.inc.php• L2213-2254).

Setup can update a configuration from wizard parameters. It preserves selected module settings, orders modules by dependency, lets module installers adjust the pending configuration, and writes the resulting settings and module list for the selected modules (core/config.class.inc.php• L2579-2776, core/config.class.inc.php• L2793-2887).

References: core/config.class.inc.php• L1805-1852 core/config.class.inc.php• L1902-1935 core/config.class.inc.php• L2020-2078 core/config.class.inc.php• L2118-2228 core/config.class.inc.php• L2236-2277 core/config.class.inc.php• L2579-2776 core/config.class.inc.php• L2793-2887 core/config.class.inc.php• L2963-3031

Module discovery and composition

A module is a named unit that declares its identity, version, dependencies, resources, and default settings. Discovery reads module declarations from the configured source roots and builds the information used by both setup and the compiled runtime (setup/modulediscovery.class.inc.php• L78-105, setup/…/ModuleFileReader.php• L69-113).

The dependency graph decides which module sets are valid and which order they must use. A selected module can therefore rely on its required modules being composed first. Missing dependencies remain visible as setup problems instead of becoming silent runtime omissions (setup/modulediscovery.class.inc.php• L201-230, setup/…/moduledependencysort.class.inc.php• L34-106).

The compiled environment is the boundary between selection and normal runtime use. Configuration generation walks the ordered modules, keeps their settings, and lets module installers prepare the generated configuration. See Startup and module composition for the detailed startup and composition flow.

References: setup/modulediscovery.class.inc.php• L78-105 setup/modulediscovery.class.inc.php• L201-230 setup/…/ModuleFileReader.php• L69-113 setup/…/moduledependencysort.class.inc.php• L34-106 core/config.class.inc.php• L2842-2887

Extension packages

An extension package is a named install choice that can contain one or more modules. The extension map finds package descriptions and standalone module choices in the product data-model area, the local extensions area, and the environment's downloaded module area (setup/extensionsmap.class.inc.php• L43-79, setup/extensionsmap.class.inc.php• L88-102, setup/extensionsmap.class.inc.php• L286-315).

The map joins files on disk with the latest extension choices recorded in the database. It keeps the newest package version, marks installed choices, retains records for packages whose source files are gone, and reports dependency or metadata problems to setup (setup/extensionsmap.class.inc.php• L209-225, setup/extensionsmap.class.inc.php• L489-512, setup/extensionsmap.class.inc.php• L653-710, setup/extensionsmap.class.inc.php• L780-817).

Installation choices can be grouped as options and mutually exclusive alternatives. The setup wizard turns those choices into selected modules. It also adds hidden or automatically selected modules so the final module set matches the package rules (setup/…/WizStepModulesChoice.php• L172-203, setup/…/WizStepModulesChoice.php• L585-704). See Installation and upgrades for the operations that apply these choices.

References: setup/extensionsmap.class.inc.php• L43-79 setup/extensionsmap.class.inc.php• L88-102 setup/extensionsmap.class.inc.php• L209-225 setup/extensionsmap.class.inc.php• L489-512 setup/extensionsmap.class.inc.php• L653-710 setup/extensionsmap.class.inc.php• L780-817 setup/…/WizStepModulesChoice.php• L172-203 setup/…/WizStepModulesChoice.php• L585-704

Dependency wiring

The runtime uses named service registries to share objects that must have one consistent instance during a request. ServiceLocator is the common access point: a service is registered before use, and a missing service raises a dependency error (sources/…/ServiceLocator.php• L12-63).

This wiring keeps consumers focused on a service contract rather than on how the service is built. For example, form code obtains the active model-reflection service through the locator, so the same form behavior can use the runtime's current model source (sources/…/FormBlockService.php• L19-35, sources/…/ClassIOFormat.php• L1-30).

Class loading combines Composer libraries with the selected environment's generated class map. This makes core and module classes available to the same process while keeping module code tied to the active environment (composer.json• L68-101, core/metamodel.class.php• L5866-5879). The metamodel can also map a loaded class back to its module. This gives shared services such as logging and performance measures useful module context (core/metamodel.class.php• L478-507, core/dbobject.class.php• L6202-6206).

References: sources/…/ServiceLocator.php• L12-63 sources/…/FormBlockService.php• L19-35 sources/…/ClassIOFormat.php• L1-30 composer.json• L68-101 core/metamodel.class.php• L478-507 core/metamodel.class.php• L5866-5879 core/dbobject.class.php• L6202-6206

Plugin and interface extension

Interface discovery finds concrete extension classes that implement a requested interface after the active class maps are loaded. It excludes classes outside the active application paths and can use a static cache in normal runtime or a more flexible cache mode during development (sources/…/InterfaceDiscovery.php• L45-65, sources/…/InterfaceDiscovery.php• L167-204, sources/…/InterfaceDiscovery.php• L229-252).

The plugin manager turns those class names into objects only when a caller asks for them. It reuses created instances, so a module can add behavior at a shared extension point without changing the core caller. The older MetaModel::EnumPlugins() path remains available beside the newer interface-discovery service (core/pluginmanager.class.inc.php• L28-87, core/plugininstanciationmanager.class.inc.php• L8-25, core/metamodel.class.php• L6824-6849).

The metamodel keeps a defined set of extension interfaces for login, user interface, query, module, and performance behavior. It invokes module handlers after model startup, then starts the event service so extensions can register their event work (core/metamodel.class.php• L5760-5802, core/metamodel.class.php• L7067-7109). A module adds behavior through these points instead of owning the application entry point.

References: sources/…/InterfaceDiscovery.php• L45-65 sources/…/InterfaceDiscovery.php• L167-204 sources/…/InterfaceDiscovery.php• L229-252 core/pluginmanager.class.inc.php• L28-87 core/plugininstanciationmanager.class.inc.php• L8-25 core/metamodel.class.php• L5760-5802 core/metamodel.class.php• L6824-6849 core/metamodel.class.php• L7067-7109 application/menunode.class.inc.php• L75-86

Event extension

The event service provides a time-based extension path. A module registers an event and its listeners. A matching source or context then sends event data to those listeners in priority order (sources/…/EventService.php• L22-29, sources/…/EventService.php• L57-118, sources/…/EventService.php• L320-346).

Persistent objects provide a second event path for object lifecycle work. An object can keep local callbacks for write, delete, value, archive, and related events. The object runs these callbacks first, then sends the event to global listeners registered for the event (core/dbobject.class.php• L6119-6222). This lets a feature react to a specific object or to a wider class family without changing the core data flow.

The service starts after the metamodel so it can discover every class that declares event setup. Delivery filters listeners by source and context. A blocking listener error stops delivery; other errors are logged and raised after the remaining listeners run (sources/…/EventService.php• L40-55, sources/…/EventService.php• L130-190, core/metamodel.class.php• L5799-5801).

References: sources/…/EventService.php• L22-29 sources/…/EventService.php• L40-55 sources/…/EventService.php• L57-118 sources/…/EventService.php• L130-190 sources/…/EventService.php• L320-346 core/dbobject.class.php• L6119-6222 core/metamodel.class.php• L5799-5801

Action and notification extensions

Actions and triggers provide a data-driven extension path for feature behavior. The core data model links triggers to actions and lets concrete actions create notifications from the trigger object and its context (core/datamodel.core.xml• L689-716, core/datamodel.core.xml• L836-857).

Notification actions can select recipients from model data and choose synchronous or asynchronous delivery. Test mode limits delivery to its test recipient. The global setting supplies the default when an action does not set its own mode (core/action.class.inc.php• L42-107, core/action.class.inc.php• L263-270, core/datamodel.core.xml• L293-418).

This path connects runtime events to user-visible results while keeping the action definition in the model. Notification links retain trigger, action, contact, and subscription state so later delivery can honor user choices (core/datamodel.core.xml• L4-67, core/datamodel.core.xml• L422-511).

References: core/action.class.inc.php• L42-107 core/action.class.inc.php• L263-270 core/datamodel.core.xml• L4-67 core/datamodel.core.xml• L293-418 core/datamodel.core.xml• L422-511 core/datamodel.core.xml• L689-716 core/datamodel.core.xml• L836-857

Shared runtime services

Shared services give web requests, command-line tasks, setup, and extensions the same rules for model state, module identity, derived data, limits, content safety, and diagnostics. These services support feature flows without becoming feature-specific entry points.

The main shared concerns are:

References: sources/…/ModuleService.php• L33-78 sources/…/ModuleService.php• L129-185 sources/…/DataModelDependantCache.php• L9-18 sources/…/DataModelDependantCache.php• L37-61 sources/…/ExecutionLimits.php• L12-45 core/htmlsanitizer.class.inc.php• L31-80 core/log.class.inc.php• L405-425 core/log.class.inc.php• L753-821 core/log.class.inc.php• L907-956 core/metamodel.class.php• L5804-5853

Setup readiness checks

Setup uses a common check result model to separate errors, warnings, information, and trace output. Its platform checks cover the PHP version, required extensions, writable paths, temporary storage, upload settings, memory, and session storage. CLI checks stop the process when an error result remains (setup/setuputils.class.inc.php• L23-80, setup/setuputils.class.inc.php• L98-118, setup/setuputils.class.inc.php• L149-240, setup/setuputils.class.inc.php• L431-451).

The module choice step analyzes all relevant source roots before it presents choices. It includes the source tree, local extensions, copied extensions, and environment-specific remote modules. Remote modules are hidden and treated as mandatory unless forced removal is active. This protects the selected environment from an incomplete module set (setup/setuputils.class.inc.php• L1647-1687).

During an upgrade, the landing step loads the target environment's build configuration and restores the saved extension and module choices when the wizard is skipped. It still checks those choices before allowing the flow to reach the data audit (setup/…/WizStepLandingBeforeAudit.php• L12-39, setup/…/WizStepLandingBeforeAudit.php• L51-118).

References: setup/setuputils.class.inc.php• L23-80 setup/setuputils.class.inc.php• L98-118 setup/setuputils.class.inc.php• L149-240 setup/setuputils.class.inc.php• L431-451 setup/setuputils.class.inc.php• L1647-1687 setup/…/WizStepLandingBeforeAudit.php• L12-39 setup/…/WizStepLandingBeforeAudit.php• L51-118

Change checklist

When these files or sections are changed, remember to consider these:

  • When a module declaration changes its identity, version, dependencies, settings, or visibility, check discovery, dependency order, extension choices, and generated configuration together.
  • When an environment or generated class map changes, check module includes, interface-discovery cache behavior, and any cache boundary tied to the environment.
  • When a configuration setting changes, check its default and its environment-file value. Setup parameters must map to the same setting names and preserve secure defaults.
  • When configuration placeholders change, check the environment and server input names, array expansion, fallback handling, type conversion, and the write-back form of values.
  • When an extension choice changes, check the mapping from package choices to module IDs. Hidden, automatic, mandatory, and alternative choices must still produce the intended set.
  • When adding an interface or event extension point, check class discovery, registration timing, listener order, and the error contract as one public contract.
  • When changing object lifecycle callbacks, check both local object listeners and global event listeners. Confirm that blocking and non-blocking errors still have the intended result.
  • When changing action or notification model fields, check trigger links, recipient selection, subscriptions, test delivery, and the asynchronous setting together.
  • When changing sanitizer or log configuration, check the configured class contract and its failure path. A bad safety or diagnostic setting can change runtime behavior without a code error at the call site.
  • When changing setup source roots or remote module rules, check both installation and upgrade analysis. A source can be available for discovery but still be hidden or mandatory in the wizard.

Important failure modes

TriggerConsequenceGuard
The selected environment has no readable configuration file.Startup stops before the metamodel can load.Keep the environment configuration path valid and readable. Config checks it before loading.
A configuration file has invalid PHP, unexpected output, or lacks the required settings array.Configuration loading fails before feature code runs.Generate the file through the configuration path and keep its data-only shape.
A configuration placeholder has no matching environment or server value and no fallback.Configuration loading stops while the setting is resolved.Provide the required external value or use the supported fallback form.
Startup is requested for a second environment in the same process.The metamodel keeps the first environment and does not switch.Use one active environment per process.
A selected module has a missing dependency.Setup reports an invalid choice or omits the module from a valid composition.Declare compatible dependencies and review the dependency result before composing the environment.
The active environment class map or discovery cache is stale.New interface-based behavior is not found.Rebuild the environment or use the intended development cache mode.
An event is sent before registration.The event service raises an error and does not deliver the event.Register events during service setup before any caller sends them.
A local event callback is missing or throws a blocking event error.The object event flow cannot complete.Keep callback names and event contracts aligned. Use blocking errors only when the caller must stop.
An extension class is outside the active paths or cannot be instantiated.The feature runs without that extension behavior.Keep the class in the active module map and follow the requested constructor contract.
The configured sanitizer is invalid or both the configured and fallback sanitizers fail.HTML may be cleaned by a fallback, or may remain unchanged after an error.Configure a loadable HTMLSanitizer implementation and monitor the issue log.
A log level or file-name builder setting is invalid.Logging can be skipped or raise a configuration error.Use supported levels and an implementation of the required builder interface.
A chosen extension has no code or its source is removed.Setup can stop or force removal of the affected extension.Keep package metadata and module files aligned. Review missing-source choices before continuing.
A setup upgrade removes a non-uninstallable or remote extension without the required override.The wizard blocks the change or returns to the choice step.Keep protected choices selected unless a deliberate forced removal is in progress.
A product installation has modules in the manual extension directory.Setup warns that the product environment is not valid.Keep product modules in the supported product source and remote module paths.

Key files

FileWhy to read it
application/startup.inc.phpShows the normal request path into environment selection and metamodel startup.
sources/…/StartupService.phpDefines the runtime environment boundary.
core/config.class.inc.phpDefines configuration defaults, loading, placeholder resolution, module settings, and generated module includes.
core/metamodel.class.phpConnects configuration, class loading, model startup, module identity, plugin hooks, and event startup.
setup/modulediscovery.class.inc.phpDefines module scanning and dependency-order entry points.
setup/…/ModuleFileReader.phpDefines the safe metadata-reading contract for module declarations.
setup/…/moduledependencysort.class.inc.phpExplains how module dependencies become a load order.
setup/extensionsmap.class.inc.phpExplains package discovery, installed choices, source loss, and extension validity.
setup/setuputils.class.inc.phpShows platform readiness checks and the module set used for installation analysis.
setup/…/WizStepModulesChoice.phpShows how package choices become modules and how protected choices affect setup.
setup/…/WizStepLandingBeforeAudit.phpShows how upgrade setup restores choices and checks them before data audit.
sources/…/ServiceLocator.phpDefines the shared named-service registry.
sources/…/InterfaceDiscovery.phpDefines interface class discovery and cache modes.
core/pluginmanager.class.inc.phpDefines lazy plugin lookup and instance reuse.
sources/…/EventService.phpDefines event registration, listener filtering, order, and error delivery.
core/dbobject.class.phpShows object lifecycle events, local callbacks, global event delivery, and CRUD protection.
core/action.class.inc.phpShows the common action contract and notification execution choices.
core/datamodel.core.xmlDefines core action, trigger, notification, subscription, and extension model links.
core/htmlsanitizer.class.inc.phpDefines configurable content sanitization and fallback behavior.
core/log.class.inc.phpDefines configurable logging levels, file routing, database issue records, and rotation selection.
sources/…/ModuleService.phpShows how runtime code maps back to module context.
sources/…/DataModelDependantCache.phpShows cache behavior for values tied to the data model.
sources/…/ExecutionLimits.phpDefines bounded work for shared runtime tasks.
docs/startup-and-module-composition.mdChild page for the detailed startup and module-composition lifecycle.
docs/installation-and-upgrades.mdRelated page for installation, removal, and upgrade operations.