If the cache should fail, don't bring down the whole app
This commit is contained in:
parent
a5acbc7bff
commit
adbde0ad09
|
|
@ -14,6 +14,7 @@ use October\Rain\Halcyon\Datasource\FileDatasource;
|
|||
use ApplicationException;
|
||||
use SystemException;
|
||||
use DirectoryIterator;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* This class represents the CMS theme.
|
||||
|
|
@ -147,9 +148,14 @@ class Theme
|
|||
$activeTheme = Config::get('cms.activeTheme');
|
||||
|
||||
if (App::hasDatabase()) {
|
||||
$dbResult = Cache::remember(self::ACTIVE_KEY, 1440, function() {
|
||||
return Parameters::applyKey(self::ACTIVE_KEY)->pluck('value');
|
||||
});
|
||||
try {
|
||||
$dbResult = Cache::remember(self::ACTIVE_KEY, 1440, function() {
|
||||
return Parameters::applyKey(self::ACTIVE_KEY)->pluck('value');
|
||||
});
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
$dbResult = Parameters::applyKey(self::ACTIVE_KEY)->pluck('value');
|
||||
}
|
||||
|
||||
if ($dbResult !== null && static::exists($dbResult)) {
|
||||
$activeTheme = $dbResult;
|
||||
|
|
|
|||
Loading…
Reference in New Issue