update ChangeLog, remove insert_tag_check parameter

This commit is contained in:
mohrt
2002-01-24 20:13:24 +00:00
parent a01b54c368
commit 548274b70d
4 changed files with 22 additions and 31 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- removed insert_tag_check, no longer needed (Monte)
- optimize cache fetches by scanning for insert tags only if they exist (Monte)
- fixed bugs in overlib (Monte, Duncan Forrest) - fixed bugs in overlib (Monte, Duncan Forrest)
- fixed a problem with compile_id usage. (Andrei) - fixed a problem with compile_id usage. (Andrei)
- fixed problem with using assigned vars with {include_php ...} filepath. - fixed problem with using assigned vars with {include_php ...} filepath.

View File

@@ -94,12 +94,6 @@ class Smarty
var $cache_dir = './cache'; // name of directory for template cache files var $cache_dir = './cache'; // name of directory for template cache files
var $cache_lifetime = 3600; // number of seconds cached content will persist. var $cache_lifetime = 3600; // number of seconds cached content will persist.
// 0 = never expires. default is one hour (3600) // 0 = never expires. default is one hour (3600)
var $insert_tag_check = true; // if you have caching turned on and you
// don't use {insert} tags anywhere
// in your templates, set this to false.
// this will tell Smarty not to look for
// insert tags, thus speeding up cached page
// fetches. true/false default true.
var $cache_handler_func = null; // function used for cached content. this is var $cache_handler_func = null; // function used for cached content. this is
// an alternative to using the built-in file // an alternative to using the built-in file
// based caching. // based caching.
@@ -548,7 +542,7 @@ class Smarty
$this->_cache_info[] = array('template', $_smarty_tpl_file); $this->_cache_info[] = array('template', $_smarty_tpl_file);
if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) { if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) {
if ($this->insert_tag_check) { if ( $this->_cache_info['insert_tags'] ) {
$_smarty_results = $this->_process_cached_inserts($_smarty_results); $_smarty_results = $this->_process_cached_inserts($_smarty_results);
} }
if ($_smarty_display) { if ($_smarty_display) {
@@ -1400,9 +1394,14 @@ function _run_insert_handler($args)
\*======================================================================*/ \*======================================================================*/
function _write_cache_file($tpl_file, $cache_id, $compile_id, $results) function _write_cache_file($tpl_file, $cache_id, $compile_id, $results)
{ {
// determine if insert tags are present
if (strpos($results,$this->_smarty_md5.'{insert_cache')) {
$this->_cache_info['insert_tags'] = true;
}
// put timestamp in cache header // put timestamp in cache header
$this->_cache_info['timestamp'] = time(); $this->_cache_info['timestamp'] = time();
// prepend the cache header info into cache file // prepend the cache header info into cache file
$results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results; $results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results;
@@ -1462,8 +1461,8 @@ function _run_insert_handler($args)
$cache_header = $cache_split[0]; $cache_header = $cache_split[0];
if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') { if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') {
$cache_info = unserialize(substr($cache_header, 24)); $this->_cache_info = unserialize(substr($cache_header, 24));
$cache_timestamp = $cache_info['timestamp']; $cache_timestamp = $this->_cache_info['timestamp'];
if (time() - $cache_timestamp > $this->cache_lifetime) { if (time() - $cache_timestamp > $this->cache_lifetime) {
// cache expired, regenerate // cache expired, regenerate
@@ -1471,7 +1470,7 @@ function _run_insert_handler($args)
} }
if ($this->compile_check) { if ($this->compile_check) {
foreach ($cache_info as $curr_cache_info) { foreach ($this->_cache_info as $curr_cache_info) {
switch ($curr_cache_info[0]) { switch ($curr_cache_info[0]) {
case 'template': case 'template':
$this->_fetch_template_info($curr_cache_info[1], $template_source, $template_timestamp, false); $this->_fetch_template_info($curr_cache_info[1], $template_source, $template_timestamp, false);

View File

@@ -468,15 +468,6 @@ require_once(SMARTY_DIR."Smarty.class.php");
Smarty 1.3.0) Smarty 1.3.0)
</para> </para>
</sect2> </sect2>
<sect2 id="setting.insert.tag.check">
<title>$insert_tag_check</title>
<para>
If you have $caching enabled and you do not use the <link
linkend="builtin.functions.insert">insert</link> tag anywhere in
your templates, set this to false. This saves the insert tag
search, speeding up cached page fetches.
</para>
</sect2>
<sect2 id="setting.cache.handler.func"> <sect2 id="setting.cache.handler.func">
<title>$cache_handler_func</title> <title>$cache_handler_func</title>
<para> <para>

View File

@@ -94,12 +94,6 @@ class Smarty
var $cache_dir = './cache'; // name of directory for template cache files var $cache_dir = './cache'; // name of directory for template cache files
var $cache_lifetime = 3600; // number of seconds cached content will persist. var $cache_lifetime = 3600; // number of seconds cached content will persist.
// 0 = never expires. default is one hour (3600) // 0 = never expires. default is one hour (3600)
var $insert_tag_check = true; // if you have caching turned on and you
// don't use {insert} tags anywhere
// in your templates, set this to false.
// this will tell Smarty not to look for
// insert tags, thus speeding up cached page
// fetches. true/false default true.
var $cache_handler_func = null; // function used for cached content. this is var $cache_handler_func = null; // function used for cached content. this is
// an alternative to using the built-in file // an alternative to using the built-in file
// based caching. // based caching.
@@ -548,7 +542,7 @@ class Smarty
$this->_cache_info[] = array('template', $_smarty_tpl_file); $this->_cache_info[] = array('template', $_smarty_tpl_file);
if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) { if ($this->_read_cache_file($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_results)) {
if ($this->insert_tag_check) { if ( $this->_cache_info['insert_tags'] ) {
$_smarty_results = $this->_process_cached_inserts($_smarty_results); $_smarty_results = $this->_process_cached_inserts($_smarty_results);
} }
if ($_smarty_display) { if ($_smarty_display) {
@@ -1400,9 +1394,14 @@ function _run_insert_handler($args)
\*======================================================================*/ \*======================================================================*/
function _write_cache_file($tpl_file, $cache_id, $compile_id, $results) function _write_cache_file($tpl_file, $cache_id, $compile_id, $results)
{ {
// determine if insert tags are present
if (strpos($results,$this->_smarty_md5.'{insert_cache')) {
$this->_cache_info['insert_tags'] = true;
}
// put timestamp in cache header // put timestamp in cache header
$this->_cache_info['timestamp'] = time(); $this->_cache_info['timestamp'] = time();
// prepend the cache header info into cache file // prepend the cache header info into cache file
$results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results; $results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results;
@@ -1462,8 +1461,8 @@ function _run_insert_handler($args)
$cache_header = $cache_split[0]; $cache_header = $cache_split[0];
if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') { if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') {
$cache_info = unserialize(substr($cache_header, 24)); $this->_cache_info = unserialize(substr($cache_header, 24));
$cache_timestamp = $cache_info['timestamp']; $cache_timestamp = $this->_cache_info['timestamp'];
if (time() - $cache_timestamp > $this->cache_lifetime) { if (time() - $cache_timestamp > $this->cache_lifetime) {
// cache expired, regenerate // cache expired, regenerate
@@ -1471,7 +1470,7 @@ function _run_insert_handler($args)
} }
if ($this->compile_check) { if ($this->compile_check) {
foreach ($cache_info as $curr_cache_info) { foreach ($this->_cache_info as $curr_cache_info) {
switch ($curr_cache_info[0]) { switch ($curr_cache_info[0]) {
case 'template': case 'template':
$this->_fetch_template_info($curr_cache_info[1], $template_source, $template_timestamp, false); $this->_fetch_template_info($curr_cache_info[1], $template_source, $template_timestamp, false);