/** * * @return void */ function __construct() { $this->cache = Zend_Registry::get('cache'); $this->config = Zend_Registry::get('config'); $this->cachePath = Sydney_Tools::getCachePath(); // clean the old cache $this->cache->clean(Zend_Cache::CLEANING_MODE_OLD); }
/** * @param $fullpath * @param null $cachpath */ public function setPath($fullpath, $cachpath = null) { $pi = pathinfo($fullpath); $this->dirname = $pi['dirname']; $this->basename = $pi['basename']; $this->extension = strtoupper($pi['extension']); $this->filename = $pi['filename']; // set the cache dir path if we have one in the config if ($cachpath == null) { //$t = Sydney_Tools::getCachePath(); //if (isset($t)) $this->cachepath = Sydney_Tools::getCachePath(); } else { $this->cachepath = $cachpath; } }
/** * */ public function indexAction() { $r = $this->getRequest(); if (isset($r->vfname)) { $this->vfname = $r->vfname; } $ex = explode('.', $this->vfname); $this->currentType = $ex[1]; if ($this->currentType == 'js') { $this->getResponse()->setHeader('Content-type', 'text/javascript'); } if ($this->currentType == 'css') { $this->getResponse()->setHeader('Content-type', 'text/css'); } $fomnameCache = $ex[0]; $frontendOptions = array('lifetime' => 2000000, 'automatic_serialization' => true); $backendOptions = array('cache_dir' => Sydney_Tools::getCachePath()); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); if (!($result = $cache->load($fomnameCache))) { $result = $this->_concatScripts(); $cache->save($result, $fomnameCache); } $this->view->script = $result; }