Esempio n. 1
0
 public function infoAction()
 {
     $cacheManager = new Cache_Manager();
     $sysCache = $cacheManager->get('system');
     $dataCache = $cacheManager->get('data');
     $results = array();
     if ($sysCache && $sysCache instanceof Cache_Memcache) {
         $results = $sysCache->getHandler()->getExtendedStats();
     }
     if ($dataCache && $dataCache instanceof Cache_Memcache) {
         $results = array_merge($results, $dataCache->getHandler()->getExtendedStats());
     }
     if (empty($results)) {
         Response::jsonSuccess(array());
     }
     $resultData = array();
     $count = 0;
     foreach ($results as $k => $v) {
         foreach ($v as $item => $value) {
             $resultData[] = array('group' => $k, 'title' => $item, 'value' => $value, 'id' => $count);
             $count++;
         }
     }
     Response::jsonSuccess(array_values($resultData));
 }
Esempio n. 2
0
 public static function resetCache($name)
 {
     $cacheManager = new Cache_Manager();
     $cache = $cacheManager->get($name);
     if (!$cache) {
         return false;
     }
     return $cache->clean();
 }
Esempio n. 3
0
 public function __construct()
 {
     $cfg = Registry::get('main', 'config');
     $this->_path = $cfg['dictionary'];
     $cacheManager = new Cache_Manager();
     $this->_cache = $cacheManager->get('data');
     if ($this->_cache && ($list = $this->_cache->load(self::CACHE_KEY_LIST))) {
         self::$_list = $list;
     }
 }
Esempio n. 4
0
 public function __construct()
 {
     parent::__construct();
     $cacheManager = new Cache_Manager();
     $this->_configBackend = Registry::get('backend', 'config');
     $this->_module = $this->getModule();
     $this->_cache = $cacheManager->get('data');
     if (Request::get('logout', 'boolean', false)) {
         User::getInstance()->logout();
         session_destroy();
         if (!Request::isAjax()) {
             Response::redirect(Request::url(array($this->_configMain->get('adminPath'))));
         }
     }
     $this->checkAuth();
     $this->includeScripts();
 }
Esempio n. 5
0
 public function __construct()
 {
     $this->_page = Page::getInstance();
     $this->_resource = Resource::getInstance();
     $this->_module = $this->getModule();
     $this->_lang = Lang::lang();
     $this->_db = static::$_defaultDb;
     $this->_configMain = Registry::get('main', 'config');
     $cacheManager = new Cache_Manager();
     $this->_configBackoffice = Config::factory(Config::File_Array, $this->_configMain->get('configs') . 'backend.php');
     $this->_cache = $cacheManager->get('data');
     if (Request::get('logout', 'boolean', false)) {
         User::getInstance()->logout();
         session_destroy();
         if (!Request::isAjax()) {
             Response::redirect(Request::url(array('index')));
         }
     }
     $this->checkAuth();
     if ($this->_configBackoffice->get('use_csrf_token')) {
         $csrf = new Security_Csrf();
         $this->_page->csrfToken = $csrf->createToken();
     }
 }
Esempio n. 6
0
 protected function _getModulesRoutes()
 {
     if (isset($this->_moduleRoutes)) {
         return $this->_moduleRoutes;
     }
     $this->_moduleRoutes = array();
     $cacheManager = new Cache_Manager();
     $cache = $cacheManager->get('data');
     if (!$cache || !($list = $cache->load(self::CACHE_KEY_ROUTES))) {
         $pageModel = Model::factory('Page');
         $db = $pageModel->getDbConnection();
         $sql = $db->select()->from($pageModel->table(), array('code', 'func_code'))->where('`published` = 1')->where('`func_code` !="" ');
         $list = $db->fetchAll($sql);
         if ($cache) {
             $cache->save($list, self::CACHE_KEY_ROUTES);
         }
     }
     if (!empty($list)) {
         foreach ($list as $item) {
             $this->_moduleRoutes[$item['func_code']] = $item['code'];
         }
     }
     return $this->_moduleRoutes;
 }
Esempio n. 7
0
 /**
  * Get system cache frontend
  * @return Cache_Interface
  * @deprecated
  */
 public static function getSystemCache()
 {
     $cacheManager = new Cache_Manager();
     return $cacheManager->get('system');
 }