Esempio n. 1
0
 /**
  * Returns cache
  *
  * @return AppCache The update cache
  * @since 2.0
  */
 protected function getCache()
 {
     if (empty($this->_cache)) {
         $this->_cache = $this->app->cache->create($this->app->path->path('cache:') . '/zoo_update_cache');
         if (!$this->_cache->check()) {
             $this->app->system->application->enqueueMessage('Cache not writeable please update the file permissions!', 'warning');
         }
     }
     return $this->_cache;
 }
Esempio n. 2
0
 /**
  * Class constructor
  *
  * @param string $app App instance.
  * @since 2.0
  */
 public function __construct($app)
 {
     parent::__construct($app);
     if ($app->get('cache_routes', false)) {
         // get route cache
         // refreshes after one hour automatically
         $this->_cache = $app->cache->create($app->path->path('cache:') . '/routes', true, 3600, 'apc');
         if (!$this->_cache || !$this->_cache->check()) {
             $this->_cache = null;
         } else {
             $this->_find(null, null);
             $key = json_encode($this->_menu_items);
             if (!$this->_cache->get($key)) {
                 $this->_cache->clear()->set($key, true)->save();
             }
         }
     }
     if ($app->request->getCmd('task') == 'category' || $app->request->getCmd('view') == 'category') {
         $this->_category_id = (int) $app->request->getInt('category_id', method_exists($app->system->application, 'getParams') ? $app->system->application->getParams()->get('category') : null);
     }
     if ($menu_item = $app->menu->getActive()) {
         $this->_active_menu_item_id = $menu_item->id;
     }
 }
Esempio n. 3
0
 /**
  * Class constructor
  *
  * @param string $app App instance.
  */
 public function __construct($app)
 {
     // set application
     $this->app = $app;
     // cache
     if ($this->app->get('cache_routes', false)) {
         // get route cache
         // refreshes after one hour automatically
         $this->_cache = $this->app->cache->create($this->app->path->path('cache:') . '/routes', true, 3600, 'apc');
         if (!$this->_cache || !$this->_cache->check()) {
             $this->_cache = null;
         } else {
             $this->_find(null, null);
             $key = json_encode($this->_menu_items);
             if (!$this->_cache->get($key)) {
                 $this->_cache->clear()->set($key, true)->save();
             }
         }
     }
     // save default menu
     if ($menu_item = $this->app->menu->getActive()) {
         $this->_active_menu_item_id = $menu_item->id;
     }
 }