Beispiel #1
0
 /**
  *
  * @return Conjoon_Modules_Default_ApplicationCache_Facade
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 /**
  * Prepares the session to set the "clear" flag in the application
  * namespace based on the passed argument "clear", which can be either
  * "true" or  "false", so that delivering the manifest file while this flag
  * is set to true contains no caching content.
  * If the flag is set to "false", this method will also assign the total
  * number of cache entries to the view-variable "cacheEntryCount".
  * If the flag is set to true, "cacheEntryCount" will be set to "0".
  */
 public function setClearFlagAction()
 {
     $clear = $this->_request->getParam('clear');
     /**
      * @see Zend_Session_Namespace
      */
     require_once 'Zend/Session/Namespace.php';
     /**
      * @see Conjoon_Keys
      */
     require_once 'Conjoon/Keys.php';
     $appNs = new Zend_Session_Namespace(Conjoon_Keys::SESSION_APPLICATION_CACHE);
     $appNs->clear = $clear;
     $cacheEntryCount = 0;
     $userId = $this->_helper->registryAccess()->getUserId();
     /**
      * @see Conjoon_Modules_Default_ApplicationCache_Facade
      */
     require_once 'Conjoon/Modules/Default/ApplicationCache/Facade.php';
     $appCacheFacade = Conjoon_Modules_Default_ApplicationCache_Facade::getInstance();
     $appCacheFacade->setCacheLastChangedTimestampForUserId(microtime(true), $userId);
     if (!$clear) {
         /**
          * @see Conjoon_Modules_Default_ApplicationCache_Facade
          */
         require_once 'Conjoon/Modules/Default/ApplicationCache/Facade.php';
         $applicationPath = $this->_helper->registryAccess()->getApplicationPath();
         $cacheEntryCount = $appCacheFacade->getCacheEntryCountForUserId($userId, $applicationPath . '/manifest');
     }
     $this->view->success = true;
     $this->view->cacheEntryCount = $cacheEntryCount;
     $this->view->error = null;
 }