Blogs / Gaetano Giunta / The definitive guide to eZ Publish settings priority

The definitive guide to eZ Publish settings priority

Saturday 23 July 2011 3:34:30 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

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.

eZ debug

Timing: Jan 17 2025 23:38:45
Script start
Timing: Jan 17 2025 23:38:45
Module start 'content'
Timing: Jan 17 2025 23:38:45
Module end 'content'
Timing: Jan 17 2025 23:38:45
Script end

Main resources:

Total runtime0.1537 sec
Peak memory usage4,096.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.9531180.8203
Module start 'content' 0.00610.0050 768.7734103.4688
Module end 'content' 0.01100.1426 872.2422536.3984
Script end 0.1536  1,408.6406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.5878200.0002
Check MTime0.00140.9298200.0001
Mysql Total
Database connection0.00070.439710.0007
Mysqli_queries0.110471.79131410.0008
Looping result0.00140.90081390.0000
Template Total0.142392.610.1423
Template load0.00080.498910.0008
Template processing0.141592.055810.1415
Override
Cache load0.00050.336910.0005
Sytem overhead
Fetch class attribute can translate value0.00080.501010.0008
XML
Image XML parsing0.00020.154210.0002
General
dbfile0.00261.7042200.0001
String conversion0.00000.005130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs