![]() |
VOOZH | about |
Maho's configuration system manages application settings through a hierarchical structure that merges data from XML files, PHP attributes, and the database. This architecture supports complex multi-store deployments by allowing settings to cascade from global defaults down to specific store view overrides.
The configuration system serves as the central registry for all application settings, module declarations, and class mappings. It provides a unified API to retrieve values while handling the complexity of scope inheritance and performance caching.
Key characteristics:
config.xml and system.xml files from all active modules into a single tree. app/code/core/Mage/Core/Model/Config.php274-279#[Maho\Config\Observer]) into the configuration at build time. lib/Maho/Config/Observer.php26-28 app/code/core/Mage/CatalogInventory/Model/Observer.php44default, websites, and stores levels. app/code/core/Mage/Core/Model/Config.php91-97config cache type to store the processed XML tree, tagged with CONFIG. app/code/core/Mage/Core/Model/Config.php75etc/ directory or using Attributes in their classes. app/code/core/Mage/Core/Model/Config.php279-281Sources: app/code/core/Mage/Core/Model/Config.php15-281 lib/Maho/Config/Observer.php13-46
Configuration values exist in a three-tier hierarchy. More specific scopes inherit from and can override less specific ones.
Title: Configuration Inheritance Flow
| Scope | XML Path Pattern | Database Table | Use Case |
|---|---|---|---|
| Default | default/section/group/field | core_config_data | Global settings used if no override exists. |
| Website | websites/{code}/... | core_config_data | Settings shared by all store views in a website. |
| Store | stores/{code}/... | core_config_data | Store-specific settings (e.g., Locale, Theme). |
Sources: app/code/core/Mage/Core/Model/Config.php89-95 app/Mage.php277-280
The configuration tree is assembled during the application bootstrap process. The Mage_Core_Model_Config class manages the loading sequence.
Title: Configuration Initialization Lifecycle
app/etc/ including database credentials in local.xml. app/code/core/Mage/Core/Model/Config.php277-279etc/config.xml. This defines models, blocks, helpers, and default values. app/code/core/Mage/Core/Model/Config.php15-71composer dump-autoload and merged into the configuration tree. For example, #[Maho\Config\Observer] is used to register observers lib/Maho/Config/Observer.php20-22 Examples include Mage_CatalogInventory_Model_Observer::addInventoryData app/code/core/Mage/CatalogInventory/Model/Observer.php44 Mage_GiftMessage_Model_Observer::salesEventConvertQuoteItemToOrderItem app/code/core/Mage/GiftMessage/Model/Observer.php20-21 Mage_Tag_Model_Tag::productEventAggregate app/code/core/Mage/Tag/Model/Tag.php194-195 Mage_Weee_Model_Observer::setWeeeRendererInForm app/code/core/Mage/Weee/Model/Observer.php20 Maho_AdminActivityLog_Model_Observer::logAdminLogin app/code/core/Maho/AdminActivityLog/Model/Observer.php48 and Mage_Catalog_Model_Product_Compare_Item::bindCustomerLogin app/code/core/Mage/Catalog/Model/Product/Compare/Item.php165core_config_data table are merged into the tree via the Resource Model. app/code/core/Mage/Core/Model/Config.php232-240MAHO_CONFIG__. This allows for dynamic configuration based on deployment environment. The Mage_Core_Helper_EnvironmentConfigLoader helper processes these variables. app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php11-17Sources: app/code/core/Mage/Core/Model/Config.php15-280 app/code/core/Mage/Core/Model/App.php255-261 lib/Maho/Config/Observer.php13-46 app/code/core/Mage/Core/Helper/EnvironmentConfigLoader.php11-17
Developers primarily interact with configuration through the Mage static class or by accessing the configuration tree directly via the config model.
Title: Configuration Access Pattern
| Component | Path | Description |
|---|---|---|
Mage::getStoreConfig() | app/Mage.php277-280 | High-level API to retrieve scoped configuration values for a specific store. |
Mage::getConfig()->getNode() | app/code/core/Mage/Core/Model/Config.php281-282 | Accesses the raw merged XML tree as a Maho\Simplexml\Element. |
Mage_Core_Model_Config | app/code/core/Mage/Core/Model/Config.php13-14 | The primary class responsible for managing the application configuration state. |
Maho\Config\Observer | lib/Maho/Config/Observer.php27-28 | Attribute used to register event observers directly in PHP code. |
Sources: app/Mage.php74-280 app/code/core/Mage/Core/Model/Config.php13-282 lib/Maho/Config/Observer.php13-46
To optimize performance, Maho caches the merged configuration tree.
config.CONFIG. app/code/core/Mage/Core/Model/Config.php73stores or websites) can be cached with different recursion levels to optimize lookup speed. app/code/core/Mage/Core/Model/Config.php89-95Sources: app/code/core/Mage/Core/Model/Config.php73-95
The "System Configuration" section in the Admin Panel is driven by system.xml files. These files define the UI structure (Tabs, Sections, Groups, Fields) and map them to configuration paths.
core_config_data table via the config resource model. app/code/core/Mage/Core/Model/Config.php232-240config cache type is cleared (tagged with CONFIG) to ensure the new values are loaded in the next request. app/code/core/Mage/Core/Model/Config.php73Sources: app/code/core/Mage/Core/Model/Config.php73-240 app/code/core/Mage/Core/Model/App.php255-261
Refresh this wiki