本文整理汇总了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');
}
示例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;
}
示例3: cleanCache
/**
* Clean cache
*/
protected function cleanCache()
{
\Less_Cache::$gc_lifetime = 2;
// Unchangeable?
\Less_Cache::CleanCache();
}
示例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
}
示例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;
}
示例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;
}
示例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;