Repository navigation
Added: A site with a VarDir of its own can keep its logs, its INI cache and its expiry timestamps apart from the other sites of the installation - #136
Merged
se7enxweb merged 6 commits intoOct 7, 2026
Conversation
added 6 commits
October 7, 2026 09:57
…he and its expiry timestamps apart from the other sites of the installation For multi-site hosting, site.ini [FileSettings] has four settings, all keeping the behaviour of before by default. UseGlobalLogDir=disabled writes the debug logs, the logs eZLog::write() writes to its default directory and the CSRF refusal log into the log directory of the site (eZSys::logDirectory()); LogDir may be an absolute path. ExpiryDir keeps expiry.php outside the cache directory, so a cache on a memory file system mounted at var/<site>/cache does not lose the expiry timestamps at a restart. INICacheDir=site caches the INI files of the site in its cache directory, so clearing the INI cache of one site leaves the others alone. eZSiteAccess::change() derives the log directory, the INI cache directory and the expiry file again on every change, for web requests, Velocity workers and scripts, and keeps nothing in static properties: a process that serves several sites one after another takes the paths of each from its own site.ini, and a directory a multi-site wrapper set comes back for a site without the setting. Logs on another file system use an absolute LogDir, a cache on a memory file system a mount at its own path, which keeps the cache files the web server serves at their addresses. Nothing rewrites paths as text.
… INI cache and expiry paths, their tests, settings, guide and changelog
…site of a multi-site installation into a tree of their own with one setting site.ini [FileSettings] LogVarDir=var_log and CacheVarDir=var_cache replace the first directory of VarDir in the log and cache directory (eZSys::relocatedVarDirectory()): a site with VarDir=var/example logs to var_log/example/log and caches in var_cache/example/cache, so one memory file system can hold the caches of all sites. Set once in the global override, they cover every site; ExpiryDir keeps the expiry timestamps inside VarDir. Velocity serves the public caches below CacheVarDir (packed scripts and style sheets, text to image) and nothing else there: expVelocity::staticPaths() adds them for all three engines, and only for a plain relative directory name. .htaccess_root, .htaccess_root_static and the nginx and Apache examples carry the rule to enable for other servers. Checked with the settings in the global override of an installation, under nginx with PHP-FPM and under Velocity 0.0.4.45: pages link and get their packed files from var_cache, internal cache files are refused, errors go to var_log, clearing and purging the caches works on var_cache while expiry.php stays in VarDir.
…heVarDir, the served cache paths of Velocity and the web server rules, their tests, settings, guide and changelog
…scribes how an existing multi-site setup moves to them
se7enxweb
added a commit
that referenced
this pull request
Oct 7, 2026
…paths A site with a VarDir of its own can keep its logs, its INI cache and its expiry timestamps apart from the other sites of the installation, and LogVarDir and CacheVarDir move the logs or caches of every site into a tree of their own. Reviewed in three rounds: the per-site site.ini cache, the log readers, the audit directory, the deletion guard, Velocity's reading of every siteaccess and its warm-up were refined, and tests were added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Installations that host several sites, each with a
VarDirof its own, can now keep logs, caches and expirytimestamps apart per site, or move them for all sites at once. Everything is set in
site.ini [FileSettings], andevery default keeps today's behaviour.
UseGlobalLogDir=disablederror.log,warning.log, …), the logseZLog::write()writes to its default directory and the CSRF refusal log go to the log directory of the site (eZSys::logDirectory()) instead ofvar/log.LogDirCacheDiralready may.storage.logand the debug bar's log follow it.LogVarDir,CacheVarDirVarDiris replaced (var/example→var_log/example,var_cache/example). One memory file system can then hold the caches of all sites.ExpiryDirexpiry.phpoutside the cache directory. With the cache on a memory file system, the expiry timestamps survive a restart. Otherwise image aliases created before a clear would count as current again.INICacheDir=siteVelocity and the web servers. Velocity serves the public caches below
CacheVarDir(packed scripts and stylesheets, text to image) and nothing else there.
expVelocity::staticPaths()adds them for all three engines, and onlyfor a plain relative directory name.
.htaccess_root,.htaccess_root_static, the Apache example and the nginxguide carry the matching rule, commented out, ready to enable.
Siteaccess changes.
eZSiteAccess::change()derives the log directory, the INI cache directory and the expiryfile again on every change. This holds for web requests, REST, the tree menu and scripts (
ezcache.php -s <siteaccess>, cronjobs). Nothing is kept in static properties:site.ini.setting.
The guide
doc/features/6.0/multi-site-log-and-cache-paths.mdhas sample setups (one site with its cache in memory;many sites with one log tree and one cache tree), what each cache command clears, and the behaviour under Velocity.
New API:
eZSys::logDirectory()andeZSys::relocatedVarDirectory()eZDebug::setLogDirectory()andlogDirectory()eZExpiryHandler::filePath()eZSiteAccess::updateINICacheDirectory()eZUpdateDebugLogDirectory()expVelocity::staticPaths()Why
Until now, multi-site hosting had to share more than the code:
var/log.CacheDir, whichsite.inicalls unsupported. The files servedfrom the cache would leave the served paths, and
expiry.phpwould be lost at every restart.How it was tested
New tests, all of which fail without the change:
eZSiteLogAndExpiryPathsTest(14 tests, no database):VarDirand absolute;LogVarDirandCacheVarDir, relative and absolute;eZLogandstorage.login the log directory;UseGlobalLogDir;ExpiryDirempty, relative, absolute and with a moved cache;eZSiteAccessSitePathsTest(5 tests, writes temporary siteaccesses, no database):eZSiteAccess::change()to a site with the settings and then to one without, in the same process;expVelocityEnginesTest: the public caches belowCacheVarDirare served and nothing else there. An absolute path,..or other characters are not served.Existing suites:
lib,kernel-classesandsecuritygive the same results as main.Static checks: phpcs reports no new violations; phpstan reports nothing new in the changed files.
On an installation, with one siteaccess with the settings and one without, under nginx with PHP-FPM:
var/logfor the other.ezcache.php -s <siteaccess>wrote the expiry timestamps toExpiryDir.Every cache command, cleared and purged (
global_ini,ini, tagcontent, all caches):expiry.phpinExpiryDirwas kept by every command and got the new timestamps..cleanup-trashdirectories were empty afterwards.Multi-site layout: the global override set
UseGlobalLogDir=disabled,LogVarDir=var_log,CacheVarDir=var_cache,INICacheDir=siteandExpiryDir=expiry.var_cache/<site>/cache/public/and got them (200).var_log/<site>/log.var_cache, whileexpiry.phpstayed invar/<site>/expiry/.Velocity 0.0.4.45 (engine qbix, 4 persistent workers):
directory, all 20 of the other in
var/log.Still open
var/log.Caches says.
VarDirandLogDirthemselves do not followLogVarDir. They should useeZSys::logDirectory().index_cluster.phpnamevar/only. A moved cache would have tobe added there.