Skip to content

Commit

Permalink
Avoid to expire the cache of all instances: the expiry values are sto…
Browse files Browse the repository at this point in the history
…red in each var dir rather than globally.

Useful in multisite-multidb installations.
See ezsystems/ezpublish-legacy#1240
  • Loading branch information
Opencontent committed Oct 30, 2024
1 parent 893c186 commit 3d8ec67
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kernel/classes/ezsiteaccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
9 changes: 9 additions & 0 deletions lib/ezutils/classes/ezexpiryhandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions settings/site.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3d8ec67

Please sign in to comment.