Merged in feature/PMC-1478 (pull request #7175)

PMC-1478 Update to ensure setting of cache entry for ee contents if cache does not have it stored

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Julio Cesar Laura Avendaño
2019-12-10 12:42:05 +00:00

View File

@@ -217,13 +217,17 @@ class enterprisePlugin extends PMPlugin
{
$cacheKey = config('system.workspace') . 'enterprise.ee';
// Fetch the value from cache. If not present, fetch from the filesystem.
$value = Cache::get($cacheKey, function () {
$value = Cache::get($cacheKey, function () use($cacheKey) {
if (file_exists(PATH_DATA_SITE . "ee")) {
return trim(file_get_contents(PATH_DATA_SITE . "ee"));
$contents = trim(file_get_contents(PATH_DATA_SITE . "ee"));
// Store it in cache so it can be used in the future
Cache::forever($cacheKey, $contents);
return $contents;
} else {
return null;
}
});
if ($value) {
$this->systemAvailable = unserialize($value);
} else {