diff --git a/redaxo/src/core/lib/clang/clang.php b/redaxo/src/core/lib/clang/clang.php index 6e6ee84359..6501aaec8d 100644 --- a/redaxo/src/core/lib/clang/clang.php +++ b/redaxo/src/core/lib/clang/clang.php @@ -243,10 +243,14 @@ private static function checkCache() } $file = rex_path::coreCache('clang.cache'); - if (!is_file($file)) { - rex_clang_service::generateCache(); + $cache = rex_file::getCache($file); + + // deliberately no is_file() check: a parallel cache clear could delete the file between check and read + if (!$cache) { + $cache = rex_clang_service::generateCache(); } - foreach (rex_file::getCache($file) as $id => $data) { + + foreach ($cache as $id => $data) { $clang = new self(); $clang->id = (int) $id; $clang->priority = (int) $data['priority']; diff --git a/redaxo/src/core/lib/clang/service.php b/redaxo/src/core/lib/clang/service.php index a704314e27..ac361ab506 100644 --- a/redaxo/src/core/lib/clang/service.php +++ b/redaxo/src/core/lib/clang/service.php @@ -127,7 +127,7 @@ public static function deleteCLang($id) * Schreibt Spracheigenschaften in die Datei include/clang.php. * * @throws rex_exception - * @return void + * @return array> */ public static function generateCache() { @@ -146,5 +146,7 @@ public static function generateCache() if (!rex_file::putCache($file, $clangs)) { throw new rex_exception('Clang cache file could not be generated'); } + + return $clangs; } }