The definitive guide to eZ Publish settings priority

Saturday 23 July 2011 3:34:30 pm

By : Gaetano Giunta

Every developer who has come in contact with eZ for even a short moment knows what you are talking about if you mention "settings hell": a vast number of configuration settings files that can be spread over many, many directories.

Who has not spent at least a couple of hours pulling hairs trying to understand why something was not working, only to find out that a contradicting setting was set in a file of higher priority?

Despair not, because we're here to help, with the definitive guide to settings priorities!

The goal of the following test is to establish once and for all the priorities of eZ Publish settings, depending on the folders they're set in.

Recap:

Settings can be set in ini files in the following folders:

  • settings (default value, applies globally)
  • settings/override (applies globally)
  • settings/siteaccess/<xxx> (applies only to given sitaccess)

Extensions can also add or modify some settings. Depending on whether the extensions are activated via the ActiveExtensions or ActiveAccessExtensions parameter in file site.ini, the weight and scope of their settings does change:

  • extension/<ext>/settings (applies globally)
  • extension/<ext>/settings/siteaccess/<xxx> (applies only to given sitaccess)
  • extension/<ext>/settings (applies only in siteaccess - when ext. is loaded via ActiveAccessExtensions)
  • extension/<ext>/settings/siteaccess/<xxx> (applies only to given sitaccess - when ext. is loaded via ActiveAccessExtensions)

The general setting priority is well known (override > extension > siteaccess > defaults), but what about all those pesky corner cases?

Test setup:

Extensions ext1 and ext2 are loaded in that order in override/site.ini using ActiveExtensions (no dependencies are declared for automatic extension ordering).

Extensions ext1ae and ext2ae are loaded in that order in siteaccess/<xxx>/site.ini using ActiveAccessExtensions (no dependencies are declared).

All 4 extensions declare settings in both extension/<ext>/my.ini and extension/<ext>/siteaccess/<xxx>/my.ini

The test has been executed on a stock eZP 4.5 install. ymmv with other versions.

Test 1: string setting - order of importance

At every possible location a value is set for a custm setting in a file my.ini. The value is then read and displayed in a node template using the operator ezini. When the file source of the current value is identified, the parameter is removed from that location, caches cleared and the template executed again to find the next ocation.

Order of importance of the files (strongest to weakest)
1 'override'
2 'ext1'
3 'ext2'
4 'siteaccess/<xxx>'
5 'ext1/siteaccess/<xxx>'
6 'ext2/siteaccess/<xxx>'
7 'ext1ae/siteaccess/<xxx>'
8 'ext2ae/siteaccess/<xxx>'
9 'ext1ae'
10'ext2ae'
We can notice here that for ActiveAccessExtensions extensions, putting the settings in a siteaccess directory actually makes the settings stronger instead of weaker (the opposite of what happens with extensions loaded globally). Not that locations 7 and 8 make any sense imho, as you are telling eZ two times that you want those settings only to apply to a siteaccess...

Test 2: array setting - loading order

Sometimes you only want to add values to an array setting, and the position of elements within the array is important. Can we assume that the order in which elements are added to the array is the reverse as the order of importance used when a single-valued setting is changed? Let's find out.

At every possible location a value is added to a sigle setting, of type array.

Resulting array:

0 'ext2ae'
1 'ext1ae'
2 'ext1/siteaccess/<xxx>'
3 'ext2/siteaccess/<xxx>'
4 'ext2ae/siteaccess/<xxx>'
5 'ext1ae/siteaccess/<xxx>'
6 'ext2/siteaccess/<xxx>'
7 'ext1/siteaccess/<xxx>'
8 'siteaccess'
9 'ext2'
10 'ext1'
11 'override'

We can notice here a bug: the values declared in ext1/siteaccess/<xxx> and ext2/siteaccess/<xxx> are loaded twice, once before the corresponding values from ActiveAccessExtensions extensions and once afterwards. Apart from that, the order is the inverse of the priorities found above.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:11:22
Script start
Timing: Jan 18 2025 02:11:22
Module start 'layout'
Timing: Jan 18 2025 02:11:22
Module start 'content'
Timing: Jan 18 2025 02:11:23
Module end 'content'
Timing: Jan 18 2025 02:11:23
Script end

Main resources:

Total runtime0.1277 sec
Peak memory usage6,144.0000 KB
Database Queries42

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 594.9766152.6563
Module start 'layout' 0.00520.0033 747.632839.5156
Module start 'content' 0.00850.1178 787.1484384.3906
Module end 'content' 0.12630.0014 1,171.539119.7031
Script end 0.1277  1,191.2422 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00342.6661150.0002
Check MTime0.00131.0037150.0001
Mysql Total
Database connection0.00070.521410.0007
Mysqli_queries0.061948.4828420.0015
Looping result0.00030.2694400.0000
Template Total0.082664.620.0413
Template load0.00352.729220.0017
Template processing0.079161.898620.0395
Template load and register function0.00010.077510.0001
states
state_id_array0.00241.856210.0024
state_identifier_array0.00130.997420.0006
Override
Cache load0.00272.1304710.0000
Sytem overhead
Fetch class attribute name0.00282.153730.0009
class_abstraction
Instantiating content class attribute0.00000.007130.0000
General
dbfile0.00070.5339100.0001
String conversion0.00000.005640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplblog_entry/full.tplextension/community_design/design/suncana/override/templates/blog_entry/full.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
12content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
2content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
2content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
5content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
3content/datatype/view/ezxmltags/header.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/header.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezkeyword.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezkeyword.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 32
 Number of unique templates used: 11

Time used to render debug report: 0.0001 secs