Fixes an issue where using invalid CSS in brand settings completely breaks the backend

This commit is contained in:
Samuel Georges 2015-05-06 18:44:48 +10:00
parent 58ace7ee6c
commit 445c95ad46

View File

@ -5,6 +5,7 @@ use Lang;
use Model;
use Cache;
use Less_Parser;
use Exception;
/**
* Backend settings that affect all users
@ -81,8 +82,14 @@ class BrandSettings extends Model
return Cache::get(self::CACHE_KEY);
}
$customCss = self::compileCss();
Cache::forever(self::CACHE_KEY, $customCss);
try {
$customCss = self::compileCss();
Cache::forever(self::CACHE_KEY, $customCss);
}
catch (Exception $ex) {
$customCss = '/* ' . $ex->getMessage() . ' */';
}
return $customCss;
}
@ -108,8 +115,8 @@ class BrandSettings extends Model
$parser->ModifyVars($vars);
$parser->parse(
File::get(base_path().'/modules/backend/models/brandsettings/custom.less')
. self::get('custom_css')
File::get(base_path().'/modules/backend/models/brandsettings/custom.less') .
self::get('custom_css')
);
$css = $parser->getCss();