mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
parent
044ae054f8
commit
a69455d409
@ -48,6 +48,7 @@ class Theme
|
||||
|
||||
const ACTIVE_KEY = 'cms::theme.active';
|
||||
const EDIT_KEY = 'cms::theme.edit';
|
||||
const CONFIG_KEY = 'cms::theme.config';
|
||||
|
||||
/**
|
||||
* Loads the theme.
|
||||
@ -336,7 +337,16 @@ class Theme
|
||||
return $this->configCache = [];
|
||||
}
|
||||
|
||||
$config = Yaml::parseFile($path);
|
||||
try {
|
||||
$config = Cache::rememberForever(self::CONFIG_KEY, function() use ($path) {
|
||||
return Yaml::parseFile($path);
|
||||
});
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
// Cache failed
|
||||
$config = Yaml::parseFile($path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @event cms.theme.extendConfig
|
||||
@ -455,6 +465,8 @@ class Theme
|
||||
$contents = Yaml::render($values);
|
||||
File::put($path, $contents);
|
||||
$this->configCache = $values;
|
||||
|
||||
self::resetCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -484,6 +496,7 @@ class Theme
|
||||
|
||||
Cache::forget(self::ACTIVE_KEY);
|
||||
Cache::forget(self::EDIT_KEY);
|
||||
Cache::forget(self::CONFIG_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user