From 3d8ec671b59117ac260e7be4e2cbe2e5cca11eff Mon Sep 17 00:00:00 2001 From: Luca Realdi Date: Wed, 30 Oct 2024 12:13:48 +0100 Subject: [PATCH] Avoid to expire the cache of all instances: the expiry values are stored in each var dir rather than globally. Useful in multisite-multidb installations. See https://github.com/ezsystems/ezpublish-legacy/pull/1240 --- kernel/classes/ezsiteaccess.php | 8 ++++++++ lib/ezutils/classes/ezexpiryhandler.php | 9 +++++++++ settings/site.ini | 3 +++ 3 files changed, 20 insertions(+) diff --git a/kernel/classes/ezsiteaccess.php b/kernel/classes/ezsiteaccess.php index 1b02f2b4e4..136145a9dd 100644 --- a/kernel/classes/ezsiteaccess.php +++ b/kernel/classes/ezsiteaccess.php @@ -542,6 +542,14 @@ static function change( array $access, eZINI $siteINI = null ) eZDebugSetting::writeDebug( 'kernel-siteaccess', "Updated settings to use siteaccess '$name'", __METHOD__ ); } + $ini = eZINI::instance(); + if ( $ini->hasVariable( 'ExpiryHandler', 'ExpiryFilePerSiteAccess' ) + && $ini->variable( 'ExpiryHandler', 'ExpiryFilePerSiteAccess' ) == 'enabled' ) + { + eZExpiryHandler::refresh(); + } + + return $access; } diff --git a/lib/ezutils/classes/ezexpiryhandler.php b/lib/ezutils/classes/ezexpiryhandler.php index 7503a76c3f..f7a49054e9 100644 --- a/lib/ezutils/classes/ezexpiryhandler.php +++ b/lib/ezutils/classes/ezexpiryhandler.php @@ -188,6 +188,15 @@ public static function registerShutdownFunction(){ eZDebug::writeStrict( __METHOD__ . " is deprecated. See EZP-22749.", __METHOD__ . " is deprecated" ); } + static function refresh(): void + { + if ( isset( $GLOBALS['eZExpiryHandlerInstance'] ) ) + { + unset( $GLOBALS['eZExpiryHandlerInstance'] ); + } + } + + /** * Holds the expiry timestamps array * @var array diff --git a/settings/site.ini b/settings/site.ini index e0a63c0e56..766904ae31 100644 --- a/settings/site.ini +++ b/settings/site.ini @@ -1575,3 +1575,6 @@ Password= [LinkCheck] # Used by the linkcheck cronjob, ConnectTimeout specifies the limit (in seconds) to wait for a valid connection. ConnectTimeout=3 + +[ExpiryHandler] +ExpiryFilePerSiteAccess=disabled \ No newline at end of file