public function clearAction()
 {
     $this->_helper->layout()->disableLayout(true);
     $this->_helper->viewRenderer->setNoRender(true);
     if ($this->getRequest()->isPost()) {
         $data = (object) $this->getRequest()->getPost();
         try {
             $answer = false;
             switch ($data->type) {
                 case 'route':
                     RM_Routing::clearCache();
                     RM_System_Cache::cleanAll();
                     echo true;
                     break;
                 case 'image':
                     $path = realpath(PUBLIC_PATH . '/imagecache/');
                     $mydir = opendir($path);
                     while (false !== ($file = readdir($mydir))) {
                         if ($file != "." && $file != ".." && !is_dir($path . '/' . $file)) {
                             chmod($path . '/' . $file, 0777);
                             unlink($path . '/' . $file);
                         }
                     }
                     closedir($mydir);
                     $this->view->ShowMessage('Well done.');
                     break;
             }
             echo $answer;
         } catch (Exception $e) {
             $this->view->ShowMessage($e->getMessage());
         }
     }
 }
Example #2
0
 protected function _initCache()
 {
     $cache = new RM_System_Cache();
     Zend_Registry::set('cachemanager', $cache->load());
 }