mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
renamed $localvars to $_localvars in cache-file-handling-functions,
added _get_auto_id()-function
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
|||||||
|
- renamed $localvars to $_localvars in cache-file-handling-functions,
|
||||||
|
added _get_auto_id()-function (messju)
|
||||||
- swapped compile_id and cache_id in read_cache_file and write_cache_file
|
- swapped compile_id and cache_id in read_cache_file and write_cache_file
|
||||||
(messju)
|
(messju)
|
||||||
- reverted patch for cache-file-handling (messju)
|
- reverted patch for cache-file-handling (messju)
|
||||||
|
@@ -911,18 +911,13 @@ class Smarty
|
|||||||
if (!isset($compile_id))
|
if (!isset($compile_id))
|
||||||
$compile_id = $this->compile_id;
|
$compile_id = $this->compile_id;
|
||||||
|
|
||||||
if (isset($cache_id))
|
$_auto_id = $this->_get_auto_id($cache_id, $compile_id);
|
||||||
$auto_id = (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id;
|
|
||||||
elseif(isset($compile_id))
|
|
||||||
$auto_id = $compile_id;
|
|
||||||
else
|
|
||||||
$auto_id = null;
|
|
||||||
|
|
||||||
if (!empty($this->cache_handler_func)) {
|
if (!empty($this->cache_handler_func)) {
|
||||||
$funcname = $this->cache_handler_func;
|
$_funcname = $this->cache_handler_func;
|
||||||
return $funcname('clear', $this, $dummy, $tpl_file, $cache_id, $compile_id);
|
return $_funcname('clear', $this, $dummy, $tpl_file, $cache_id, $compile_id);
|
||||||
} else {
|
} else {
|
||||||
return $this->_rm_auto($this->cache_dir, $tpl_file, $auto_id, $exp_time);
|
return $this->_rm_auto($this->cache_dir, $tpl_file, $_auto_id, $exp_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2280,19 +2275,13 @@ class Smarty
|
|||||||
|
|
||||||
if (!empty($this->cache_handler_func)) {
|
if (!empty($this->cache_handler_func)) {
|
||||||
// use cache_handler function
|
// use cache_handler function
|
||||||
$funcname = $this->cache_handler_func;
|
$_funcname = $this->cache_handler_func;
|
||||||
return $funcname('write', $this, $results, $tpl_file, $cache_id, $compile_id);
|
return $_funcname('write', $this, $results, $tpl_file, $cache_id, $compile_id);
|
||||||
} else {
|
} else {
|
||||||
// use local cache file
|
// use local cache file
|
||||||
if (isset($cache_id))
|
$_auto_id = $this->_get_auto_id($cache_id, $compile_id);
|
||||||
$auto_id = (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id;
|
$_cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $_auto_id);
|
||||||
elseif(isset($compile_id))
|
$this->_write_file($_cache_file, $results, true);
|
||||||
$auto_id = $compile_id;
|
|
||||||
else
|
|
||||||
$auto_id = null;
|
|
||||||
|
|
||||||
$cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $auto_id);
|
|
||||||
$this->_write_file($cache_file, $results, true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2322,19 +2311,13 @@ class Smarty
|
|||||||
|
|
||||||
if (!empty($this->cache_handler_func)) {
|
if (!empty($this->cache_handler_func)) {
|
||||||
// use cache_handler function
|
// use cache_handler function
|
||||||
$funcname = $this->cache_handler_func;
|
$_funcname = $this->cache_handler_func;
|
||||||
$funcname('read', $this, $results, $tpl_file, $cache_id, $compile_id);
|
$_funcname('read', $this, $results, $tpl_file, $cache_id, $compile_id);
|
||||||
} else {
|
} else {
|
||||||
// use local cache file
|
// use local cache file
|
||||||
if (isset($cache_id))
|
$_auto_id = $this->_get_auto_id($cache_id, $compile_id);
|
||||||
$auto_id = (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id;
|
$_cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $_auto_id);
|
||||||
elseif(isset($compile_id))
|
$results = $this->_read_file($_cache_file);
|
||||||
$auto_id = $compile_id;
|
|
||||||
else
|
|
||||||
$auto_id = null;
|
|
||||||
|
|
||||||
$cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $auto_id);
|
|
||||||
$results = $this->_read_file($cache_file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($results)) {
|
if (empty($results)) {
|
||||||
@@ -2386,6 +2369,15 @@ class Smarty
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _get_auto_id($cache_id=null, $compile_id=null) {
|
||||||
|
if (isset($cache_id))
|
||||||
|
return (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id;
|
||||||
|
elseif(isset($compile_id))
|
||||||
|
return $compile_id;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get filepath of requested plugin
|
* get filepath of requested plugin
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user