Ejemplo n.º 1
0
 /**
  * Clean T3 cache
  * If $t3assets > 0,  deleted all cached content in defaultgroup
  * If $t3assets > 1,  deleted all cached content in assets group
  * If $t3assets > 2, deleted all cached content in css/js optimize folder
  *
  * @param int $t3assets    Level cache
  *
  * @return void
  */
 private function _clean($t3assets = 0)
 {
     $cache = $this->cache;
     // Clear cache in default group folder
     if ($t3assets > 0) {
         $cache->clean();
     }
     // Clear cache in assets folder
     if ($t3assets > 1) {
         $cache->clean(self::T3_CACHE_ASSETS);
     }
     if ($t3assets > 2) {
         //clean t3-assets folder, the cache for js/css
         $templates = T3Common::get_active_templates();
         //T3Common::log(var_export($templates, true));
         foreach ($templates as $template) {
             $file = T3Path::path("templates/{$template}") . DS . 'params.ini';
             if (is_file($file)) {
                 $content = file_get_contents($file);
                 // $params = new JParameter($content);
                 // Strict standards: Declaration of JParameter::loadSetupFile() should be compatible with that of JRegistry::loadSetupFile()
                 $params = $content;
                 if (!$content instanceof JRegistry) {
                     $params = new JRegistry($content);
                 }
                 $cache_path = $params->get('optimize_folder', 't3-assets');
                 $path = T3Path::path($cache_path);
                 //T3Common::log($path);
                 if (is_dir($path)) {
                     @JFolder::delete($path);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Clean T3 cache
  * If $t3assets > 0,  deleted all cached content in defaultgroup
  * If $t3assets > 1,  deleted all cached content in assets group
  * If $t3assets > 2, deleted all cached content in css/js optimize folder
  *
  * @param int $t3assets    Level cache
  *
  * @return void
  */
 private function _clean($t3assets = 0)
 {
     $cache = $this->cache;
     // Clear cache in default group folder
     if ($t3assets > 0) {
         $cache->clean();
     }
     // Clear cache in assets folder
     if ($t3assets > 1) {
         $cache->clean(self::T3_CACHE_ASSETS);
     }
     if ($t3assets > 2) {
         //clean t3-assets folder, the cache for js/css
         $templates = T3Common::get_active_templates();
         //T3Common::log(var_export($templates, true));
         foreach ($templates as $template) {
             $file = T3Path::path("templates/{$template}") . DS . 'params.ini';
             if (is_file($file)) {
                 $content = file_get_contents($file);
                 $params = new JParameter($content);
                 $cache_path = $params->get('optimize_folder', 't3-assets');
                 $path = T3Path::path($cache_path);
                 //T3Common::log($path);
                 if (is_dir($path)) {
                     @JFolder::delete($path);
                 }
             }
         }
     }
 }