Skip to content

Instantly share code, notes, and snippets.

@neil96
Created April 29, 2016 08:58
Show Gist options
  • Save neil96/58f54f1b9f69c8b08413067477d7c2cc to your computer and use it in GitHub Desktop.
Save neil96/58f54f1b9f69c8b08413067477d7c2cc to your computer and use it in GitHub Desktop.
public function rebuild()
{
$flavorId = $this->flavor_folder;
if (!$flavorId) {
throw new \Exception(_p('Cannot merge a theme without a flavor.'));
}
$db = new \Core\Db();
$moduleList = $db->select('module_id')
->singleData('module_id')
->from(':module')
->where('is_active=1')
->all();
$css = new CSS($this);
try {
$data = $css->get();
//Cache content from module and app
$sCachedId = \Phpfox_Cache::instance()->set('css_module_app_less_content');
if (!($sLessData = \Phpfox_Cache::instance()->get($sCachedId))){
$moduleData = $css->getModule($moduleList);
$appData = $css->getApp();
$sLessData = $moduleData . $appData;
\Phpfox_Cache::instance()->save($sCachedId, $sLessData);
}
$css->set($data, null, $sLessData, $this->name);
} catch (\Exception $e) {
if (PHPFOX_DEBUG) {
exit("error:" . $e->getMessage());
}
return false;
}
if (is_array($moduleList)){
try {
$css->reBuildModule($moduleList);
} catch (\Exception $e) {
if (PHPFOX_DEBUG) {
exit("error:" . $e->getMessage());
}
}
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment