diff --git a/core/src/Revolution/Processors/Workspace/Lexicon/GetList.php b/core/src/Revolution/Processors/Workspace/Lexicon/GetList.php index ceca4fadd26..a853ce0c930 100644 --- a/core/src/Revolution/Processors/Workspace/Lexicon/GetList.php +++ b/core/src/Revolution/Processors/Workspace/Lexicon/GetList.php @@ -14,6 +14,7 @@ use MODX\Revolution\Formatter\modManagerDateFormatter; use MODX\Revolution\modLexiconEntry; use MODX\Revolution\Processors\Processor; +use xPDO\xPDO; /** * Gets a list of lexicon entries @@ -110,23 +111,24 @@ public function process() ); $entries = is_array($entries) ? $entries : []; + /* + * Core namespace and empty: clear lexicon cache so loadCache() elsewhere gets fresh data, + * then retry getFileTopic once in case result depended on cache/path state (#15465). + */ + if ($this->getProperty('namespace') === 'core' && empty($entries)) { + $this->modx->lexicon->clearCache(); + $this->modx->log(xPDO::LOG_LEVEL_DEBUG, 'Lexicon GetList: core topic empty, cleared cache and retried'); + $entries = $this->modx->lexicon->getFileTopic( + $this->getProperty('language'), + $this->getProperty('namespace'), + $this->getProperty('topic') + ); + $entries = is_array($entries) ? $entries : []; + } + /* if searching */ if (!empty($query)) { - function parseArray($needle, array $haystack = []) - { - if (!is_array($haystack)) { - return false; - } - $results = []; - foreach ($haystack as $key => $value) { - if (strpos($key, $needle) !== false || strpos($value, $needle) !== false) { - $results[$key] = $value; - } - } - return $results; - } - - $entries = parseArray($query, $entries); + $entries = $this->filterEntriesByQuery($query, $entries); } /* add in unique entries */ @@ -172,4 +174,24 @@ function parseArray($needle, array $haystack = []) return $this->outputArray($list, $count); } + + /** + * Filter lexicon entries by search query (key or value contains needle). + * + * @param string $query Search string. + * @param array $entries Name => value entries. + * @return array Filtered entries. + */ + private function filterEntriesByQuery(string $query, array $entries): array + { + $results = []; + foreach ($entries as $key => $value) { + $keyMatch = strpos((string) $key, $query) !== false; + $valueMatch = is_string($value) && strpos($value, $query) !== false; + if ($keyMatch || $valueMatch) { + $results[$key] = $value; + } + } + return $results; + } } diff --git a/manager/templates/default/browser/index.tpl b/manager/templates/default/browser/index.tpl index 88c835e402f..7c67f031d66 100644 --- a/manager/templates/default/browser/index.tpl +++ b/manager/templates/default/browser/index.tpl @@ -5,19 +5,19 @@ - - + + {if isset($_config.ext_debug) && $_config.ext_debug} - - + + {else} - - + + {/if} - - - + + + {$maincssjs} diff --git a/manager/templates/default/header.tpl b/manager/templates/default/header.tpl index 5f96797a981..bd9aa77d610 100644 --- a/manager/templates/default/header.tpl +++ b/manager/templates/default/header.tpl @@ -8,20 +8,20 @@ {if $_config.manager_favicon_url}{/if} - + {if isset($_config.ext_debug) && $_config.ext_debug} - - + + {else} - - + + {/if} - - - + + + + diff --git a/manager/templates/default/security/logout.tpl b/manager/templates/default/security/logout.tpl index 6846136630d..d38ae31f61e 100644 --- a/manager/templates/default/security/logout.tpl +++ b/manager/templates/default/security/logout.tpl @@ -3,29 +3,29 @@ MODx :: {$_lang.permission_denied} - - - - + + + + {if isset($_config.ext_debug) && $_config.ext_debug} - - + + {else} - - + + {/if} - - - - - - - - - - + + + + + + + + + + {literal}{/literal} diff --git a/setup/includes/runner/modinstallrunnerweb.class.php b/setup/includes/runner/modinstallrunnerweb.class.php index a5ae3a9b133..c0a639ec354 100644 --- a/setup/includes/runner/modinstallrunnerweb.class.php +++ b/setup/includes/runner/modinstallrunnerweb.class.php @@ -104,6 +104,11 @@ public function cleanup() { ], ]); + /* refresh all cache partitions (e.g. lexicon_topics) so first manager load has correct data (#14952, #15465) */ + if ($this->install->xpdo->cacheManager) { + $this->install->xpdo->cacheManager->refresh(); + } + $this->install->lock(); $this->install->settings->store([ diff --git a/setup/includes/upgrade.install.php b/setup/includes/upgrade.install.php index 7a62d7883a2..1902dd54e47 100644 --- a/setup/includes/upgrade.install.php +++ b/setup/includes/upgrade.install.php @@ -386,4 +386,9 @@ $setting->save(); } +/* clear all cache partitions (including lexicon_topics) after upgrade so manager shows correct data (#14952) */ +if ($modx->getCacheManager()) { + $modx->cacheManager->refresh(); +} + return true;