public function serviceAlertResponseSettingsSave($oAlert) { if ($oAlert->aExtras['category']['type_group'] != 'templates') { return; } $oCacheUtilities = BxDolCacheUtilities::getInstance(); $oCacheUtilities->clear('css'); $oCacheUtilities->clear('template'); }
function uninstall($aParams) { if (BxDolRequest::serviceExists('wall', 'update_handlers')) { BxDolService::call('wall', 'update_handlers', array($this->_aConfig['home_uri'], false)); } $aResult = parent::uninstall($aParams); if ($aResult['result']) { foreach ($this->_aConfig['install_permissions']['writable'] as $sDir) { $sPath = BX_DIRECTORY_PATH_MODULES . $this->_aConfig['home_dir'] . $sDir; if (is_dir($sPath)) { bx_clear_folder($sPath); } } bx_import('BxDolCacheUtilities'); $oCacheUtilities = new BxDolCacheUtilities(); $oCacheUtilities->clear('users'); } return $aResult; }
function compileLanguage($mixedLang = 0, $bForce = false) { $sType = 'all'; if (!empty($mixedLang)) { if (is_string($mixedLang) && !is_numeric($mixedLang)) { $sType = 'all_by_name'; } else { if (is_numeric($mixedLang) || is_int($mixedLang)) { $sType = 'all_by_id'; $mixedLang = (int) $mixedLang; } } } $aLanguages = array(); $iLanguages = $this->oDb->getLanguagesBy(array('type' => $sType, 'value' => $mixedLang), $aLanguages); if ($iLanguages == 0) { return false; } $oFile = BxDolFile::getInstance(); $sNewLine = "\r\n"; foreach ($aLanguages as $aLanguage) { if (!$bForce && (int) $aLanguage['enabled'] != 1) { continue; } $aKeys = array(); $this->oDb->getKeysBy(array('type' => 'by_language_id_key_key', 'value' => $aLanguage['id']), $aKeys); if ($aLanguage['name'] != BX_DOL_LANGUAGE_DEFAULT && getParam('lang_subst_from_en') == 'on') { $aKeysAll = array(); $this->oDb->getKeysBy(array('type' => 'by_language_name_key_key', 'value' => BX_DOL_LANGUAGE_DEFAULT), $aKeysAll); $aKeys = array_merge($aKeysAll, $aKeys); } $sLanguageFile = "lang-" . $aLanguage['name'] . ".php"; $oFile->delete('cache/' . $sLanguageFile); $rHandle = fopen(BX_DIRECTORY_PATH_CACHE . $sLanguageFile, 'w'); if ($rHandle === false) { return false; } $sContent = "<?php{$sNewLine}\$GLOBALS['LANG'] = array("; foreach ($aKeys as $aKey) { list($sKey, $sString) = str_replace(array("\\", "'"), array("\\\\", "\\'"), array($aKey['key'], $aKey['string'])); $sContent .= "{$sNewLine}\t'{$sKey}' => '{$sString}',"; } $sContent = trim($sContent, ','); if (fwrite($rHandle, $sContent . "{$sNewLine});?>") === false) { return false; } if (fclose($rHandle) === false) { return false; } @chmod(BX_DIRECTORY_PATH_CACHE . "lang-{$aLanguage['name']}.php", 0666); } $this->init(); BxDolCacheUtilities::getInstance()->clear('template'); return true; }
<?php /** * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/ * CC-BY License - http://creativecommons.org/licenses/by/3.0/ */ require_once '../inc/header.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin_design.inc.php'; require_once BX_DIRECTORY_PATH_INC . 'admin.inc.php'; bx_import('BxDolPaginate'); bx_import('BxDolAdminIpBlockList'); bx_import('BxDolCacheUtilities'); $logged['admin'] = member_auth(1, true, true); $aCacheTypes = array(array('action' => 'all', 'title' => _t('_adm_txt_dashboard_cache_all')), array('action' => 'db', 'title' => _t('_adm_txt_dashboard_cache_db')), array('action' => 'pb', 'title' => _t('_adm_txt_dashboard_cache_pb')), array('action' => 'template', 'title' => _t('_adm_txt_dashboard_cache_template')), array('action' => 'css', 'title' => _t('_adm_txt_dashboard_cache_css')), array('action' => 'js', 'title' => _t('_adm_txt_dashboard_cache_js')), array('action' => 'users', 'title' => _t('_adm_txt_dashboard_cache_users')), array('action' => 'member_menu', 'title' => _t('_adm_txt_dashboard_cache_member_menu'))); $oCacheUtilities = new BxDolCacheUtilities(); if (!empty($_POST['clear_cache'])) { $aResult = array(); switch ($_POST['clear_cache']) { case 'all': foreach ($aCacheTypes as $r) { $aResult = $oCacheUtilities->clear($r['action']); if ($aResult['code'] != 0) { break 2; } } break; case 'member_menu': case 'pb': case 'users': case 'db':
protected function getCacheChartData($bAsString = true) { $oCacheUtilities = BxDolCacheUtilities::getInstance(); $aChartData = array(); foreach ($this->aItemsCache as $aItem) { if ($aItem['name'] == 'all') { continue; } $iSize = $oCacheUtilities->size($aItem['name']); if ($iSize === false) { continue; } $aChartData[] = array(bx_js_string(_t('_adm_dbd_txt_c_' . $aItem['name']), BX_ESCAPE_STR_APOS), array('v' => $iSize, 'f' => bx_js_string(_t_format_size($iSize)))); } if (empty($aChartData)) { return false; } return $bAsString ? json_encode($aChartData) : $aChartData; }