/** * @param $configName string * @param $context string */ public static function InitLogger($configName, $context = null) { if (KalturaLog::getLogger()) { // already initialized return; } if (function_exists('apc_fetch')) { $cacheKey = self::LOGGER_APC_CACHE_KEY_PREFIX . $configName; $logger = apc_fetch($cacheKey); if ($logger) { list($logger, $cacheVersionId) = $logger; if ($cacheVersionId == kConf::getCachedVersionId()) { KalturaLog::setLogger($logger); return; } } } try { $config = new Zend_Config(kConf::getMap('logger')); KalturaLog::initLog($config->{$configName}); if ($context) { KalturaLog::setContext($context); } if (function_exists('apc_store')) { apc_store($cacheKey, array(KalturaLog::getLogger(), kConf::getCachedVersionId())); } } catch (Zend_Config_Exception $ex) { } }
public static function initAllowedTokenPatterns() { $cacheKey = null; if (function_exists('apc_fetch') && function_exists('apc_store')) { $cacheKey = 'kHtmlPurifierAllowedTokenPatterns-' . kConf::getCachedVersionId(); self::$allowedTokenPatterns = apc_fetch($cacheKey); } if (!self::$allowedTokenPatterns) { self::$allowedTokenPatterns = kConf::get("xss_allowed_token_patterns"); self::$allowedTokenPatterns = preg_replace("/\\\\/", "\\", self::$allowedTokenPatterns); if ($cacheKey) { apc_store($cacheKey, self::$allowedTokenPatterns); } } }