Skip to content

Commit bdc026d

Browse files
committed
[BUGFIX] Do not show frequent search terms from other languages or sites in a multisite environment
While the check for the root page id or language is present for the sql query generation, it wasn't taken into account for the cache identifier generation. This fixes the problem of items from other language or sites being shown out of the cache.
1 parent 9061824 commit bdc026d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

PiResults/FrequentSearchesCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,16 @@ protected function getFrequentSearchTerms() {
148148
$terms = array();
149149

150150
// Use configuration as cache identifier
151-
$identifier = 'frequentSearchesTags_' . md5(serialize($this->configuration['search.']['frequentSearches.']));
151+
$identifier = 'frequentSearchesTags';
152+
153+
if ($this->configuration['search.']['frequentSearches.']['select.']['checkRootPageId']) {
154+
$identifier.= '_RP' . (int)$GLOBALS['TSFE']->tmpl->rootLine[0]['uid'];
155+
}
156+
if ($this->configuration['search.']['frequentSearches.']['select.']['checkLanguage']) {
157+
$identifier.= '_L' . (int)$GLOBALS['TSFE']->sys_language_uid;
158+
}
159+
160+
$identifier.= '_' . md5(serialize($this->configuration['search.']['frequentSearches.']));
152161

153162
if ($this->cacheInstance->has($identifier)) {
154163
$terms = $this->cacheInstance->get($identifier);

0 commit comments

Comments
 (0)