当前位置: 首页>>代码示例>>PHP>>正文


PHP Less_Cache::CleanCache方法代码示例

本文整理汇总了PHP中Less_Cache::CleanCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Less_Cache::CleanCache方法的具体用法?PHP Less_Cache::CleanCache怎么用?PHP Less_Cache::CleanCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Less_Cache的用法示例。


在下文中一共展示了Less_Cache::CleanCache方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doActionCleanAggregationCache

 /**
  * Clean aggregation cache directory
  *
  * @return void
  */
 public function doActionCleanAggregationCache()
 {
     \Includes\Utils\FileManager::unlinkRecursive(LC_DIR_CACHE_RESOURCES);
     \Less_Cache::SetCacheDir(LC_DIR_DATACACHE);
     \Less_Cache::CleanCache();
     \XLite\Core\TopMessage::addInfo('Aggregation cache has been cleaned');
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:12,代码来源:CssJsPerformance.php

示例2: GetRules

 /**
  * Return the results of parsePrimary for $file_path
  * Use cache and save cached results if possible
  *
  * @param string|null $file_path
  */
 private function GetRules($file_path)
 {
     $this->SetInput($file_path);
     $cache_file = $this->CacheFile($file_path);
     if ($cache_file) {
         if (Less_Parser::$options['cache_method'] == 'callback') {
             if (is_callable(Less_Parser::$options['cache_callback_get'])) {
                 $cache = call_user_func_array(Less_Parser::$options['cache_callback_get'], array($this, $file_path, $cache_file));
                 if ($cache) {
                     $this->UnsetInput();
                     return $cache;
                 }
             }
         } elseif (file_exists($cache_file)) {
             switch (Less_Parser::$options['cache_method']) {
                 // Using serialize
                 // Faster but uses more memory
                 case 'serialize':
                     $cache = unserialize(file_get_contents($cache_file));
                     if ($cache) {
                         touch($cache_file);
                         $this->UnsetInput();
                         return $cache;
                     }
                     break;
                     // Using generated php code
                 // Using generated php code
                 case 'var_export':
                 case 'php':
                     $this->UnsetInput();
                     return include $cache_file;
             }
         }
     }
     $rules = $this->parsePrimary();
     if ($this->pos < $this->input_len) {
         throw new Less_Exception_Chunk($this->input, null, $this->furthest, $this->env->currentFileInfo);
     }
     $this->UnsetInput();
     //save the cache
     if ($cache_file) {
         if (Less_Parser::$options['cache_method'] == 'callback') {
             if (is_callable(Less_Parser::$options['cache_callback_set'])) {
                 call_user_func_array(Less_Parser::$options['cache_callback_set'], array($this, $file_path, $cache_file, $rules));
             }
         } else {
             //msg('write cache file');
             switch (Less_Parser::$options['cache_method']) {
                 case 'serialize':
                     file_put_contents($cache_file, serialize($rules));
                     break;
                 case 'php':
                     file_put_contents($cache_file, '<?php return ' . self::ArgString($rules) . '; ?>');
                     break;
                 case 'var_export':
                     //Requires __set_state()
                     file_put_contents($cache_file, '<?php return ' . var_export($rules, true) . '; ?>');
                     break;
             }
             Less_Cache::CleanCache();
         }
     }
     return $rules;
 }
开发者ID:netAction,项目名称:diabetes-schule-berlin-wordpress,代码行数:70,代码来源:Less.php

示例3: cleanCache

 /**
  * Clean cache
  */
 protected function cleanCache()
 {
     \Less_Cache::$gc_lifetime = 2;
     // Unchangeable?
     \Less_Cache::CleanCache();
 }
开发者ID:sebastienheyd,项目名称:laravel5-less,代码行数:9,代码来源:Less.php

示例4: processTheme

 /**
  * Compile scripts for the specified theme.
  *
  * @param string $theme Theme name
  *
  * @return void
  */
 protected function processTheme($theme)
 {
     $lessFiles = $this->getAllLessFiles($theme);
     if (empty($lessFiles)) {
         $this->logMessage("No LESS in " . $theme);
         return;
     }
     $this->logMessage("Processing " . $theme);
     foreach ($lessFiles as $less) {
         if (is_string($less)) {
             $this->compileFile($theme, $less);
         }
     }
     \Less_Cache::SetCacheDir(APPLICATION_PATH . '/themes/' . $theme . '/css/less/');
     \Less_Cache::CleanCache();
     // deletes week old files
 }
开发者ID:tillk,项目名称:vufind,代码行数:24,代码来源:LessCompiler.php

示例5: GetRules

 /**
  * Return the results of parsePrimary for $file_path
  * Use cache and save cached results if possible
  *
  * @param string|null $file_path
  */
 private function GetRules($file_path)
 {
     $this->SetInput($file_path);
     $cache_file = false;
     if ($file_path) {
         WP_Filesystem(Less_Parser::$options['credits']);
         global $wp_filesystem;
         $this->input = $wp_filesystem->get_contents($file_path);
     }
     $rules = $this->parsePrimary();
     if ($this->pos < $this->input_len) {
         throw new Less_Exception_Chunk($this->input, null, $this->furthest, $this->env->currentFileInfo);
     }
     $this->UnsetInput();
     //save the cache
     if ($cache_file) {
         //msg('write cache file');
         switch (Less_Parser::$options['cache_method']) {
             case 'serialize':
                 fpc($cache_file, serialize($rules));
                 break;
             case 'php':
                 fpc($cache_file, '<?php return ' . self::ArgString($rules) . '; ?>');
                 break;
             case 'var_export':
                 //Requires __set_state()
                 fpc($cache_file, '<?php return ' . var_export($rules, true) . '; ?>');
                 break;
         }
         Less_Cache::CleanCache();
     }
     return $rules;
 }
开发者ID:jwlayug,项目名称:jbst,代码行数:39,代码来源:Less.php

示例6: GetRules

 /**
  * Return the results of parsePrimary for $file_path
  * Use cache and save cached results if possible
  *
  * @param string|null $file_path
  */
 private function GetRules($file_path)
 {
     $cache_file = false;
     if ($file_path) {
         if (Less_Parser::$options['cache_method']) {
             $cache_file = $this->CacheFile($file_path);
             if ($cache_file && file_exists($cache_file)) {
                 switch (Less_Parser::$options['cache_method']) {
                     // Using serialize
                     // Faster but uses more memory
                     case 'serialize':
                         $cache = unserialize(file_get_contents($cache_file));
                         if ($cache) {
                             touch($cache_file);
                             return $cache;
                         }
                         break;
                         // Using generated php code
                     // Using generated php code
                     case 'var_export':
                     case 'php':
                         return include $cache_file;
                 }
             }
         }
         $this->input = file_get_contents($file_path);
     }
     $this->pos = $this->farthest = 0;
     // Remove potential UTF Byte Order Mark
     $this->input = preg_replace('/\\G\\xEF\\xBB\\xBF/', '', $this->input);
     $this->input_len = strlen($this->input);
     $this->setFileContent();
     $rules = $this->parsePrimary();
     if ($this->pos < $this->input_len) {
         throw new Less_Exception_Chunk($this->input, null, $this->farthest, $this->env->currentFileInfo);
     }
     // free up a little memory
     unset($this->input, $this->pos);
     //save the cache
     if ($cache_file) {
         switch (Less_Parser::$options['cache_method']) {
             case 'serialize':
                 file_put_contents($cache_file, serialize($rules));
                 break;
             case 'php':
                 file_put_contents($cache_file, '<?php return ' . self::ArgString($rules) . '; ?>');
                 break;
             case 'var_export':
                 /**
                  * Requires __set_state()
                  */
                 file_put_contents($cache_file, '<?php return ' . var_export($rules, true) . '; ?>');
                 break;
         }
         Less_Cache::CleanCache();
     }
     return $rules;
 }
开发者ID:Tommar,项目名称:vino2,代码行数:64,代码来源:less.php

示例7: locate_template

<?php

require locate_template('/lib/less/Less.php');
// Set our options for the less compiler
$bitstrappier_less_options = array('compress' => true, 'cache_dir' => get_stylesheet_directory() . '/assets/css/cache', 'cache_method' => 'php');
// The LESS file to compile and cache.
$bitstrappier_less_file = array(get_stylesheet_directory() . '/assets/less/main.less' => get_bloginfo('template_url'));
// Define the LESS file to compile, in this case the main.less
$bitstrappier_css_file_name = Less_Cache::Get($bitstrappier_less_file, $bitstrappier_less_options);
Less_Cache::CleanCache();
// Store the CSS file name in a URL with its template path
$s8_stylesheet_url = get_bloginfo('template_url') . '/assets/css/cache/' . $bitstrappier_css_file_name;
开发者ID:Station8branding,项目名称:WP_roots,代码行数:12,代码来源:less.php


注:本文中的Less_Cache::CleanCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。