cvs: smarty /libs/core core.read_cache_file.php
"Messju Mohr" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsmessju1061560935@cvsserver> |
messju Fri Aug 22 10:02:15 2003 EDT
Modified files:
/smarty/libs/core core.read_cache_file.php
Log:
discard $_cache_info when the cache should be regenerated
Index: smarty/libs/core/core.read_cache_file.php
diff -u smarty/libs/core/core.read_cache_file.php:1.11 smarty/libs/core/core.read_cache_file.php:1.12
--- smarty/libs/core/core.read_cache_file.php:1.11 Mon Aug 18 06:17:28 2003
+++ smarty/libs/core/core.read_cache_file.php Fri Aug 22 10:02:15 2003
@@ -51,47 +51,45 @@
$cache_split = explode("\n", $params['results'], 2);
$cache_header = $cache_split[0];
- $smarty->_cache_info = unserialize($cache_header);
+ $_cache_info = unserialize($cache_header);
- if ($smarty->caching == 2 && isset ($smarty->_cache_info['expires'])){
+ if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
// caching by expiration time
- if ($smarty->_cache_info['expires'] > -1 && (time() > $smarty->_cache_info['expires'])) {
- // cache expired, regenerate
- return false;
+ if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) {
+ // cache expired, regenerate
+ return false;
}
} else {
// caching by lifetime
- if ($smarty->cache_lifetime > -1 && (time() - $smarty->_cache_info['timestamp'] > $smarty->cache_lifetime)) {
- // cache expired, regenerate
- return false;
+ if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) {
+ // cache expired, regenerate
+ return false;
}
}
if ($smarty->compile_check) {
- $_params = array('get_source' => false);
- foreach (array_keys($smarty->_cache_info['template']) as $_template_dep) {
- $_params['resource_name'] = $_template_dep;
- $smarty->_fetch_resource_info($_params);
- if ($smarty->_cache_info['timestamp'] < $_params['resource_timestamp']) {
+ $_params = array('get_source' => false, 'quiet'=>true);
+ foreach (array_keys($_cache_info['template']) as $_template_dep) {
+ $_params['resource_name'] = $_template_dep;
+ if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
// template file has changed, regenerate cache
return false;
}
}
- if (isset($smarty->_cache_info['config'])) {
- $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false);
- foreach (array_keys($smarty->_cache_info['config']) as $_config_dep) {
+ if (isset($_cache_info['config'])) {
+ $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true);
+ foreach (array_keys($_cache_info['config']) as $_config_dep) {
$_params['resource_name'] = $_config_dep;
- $smarty->_fetch_resource_info($_params);
- if ($smarty->_cache_info['timestamp'] < $_params['resource_timestamp']) {
- // config file has changed, regenerate cache
- return false;
- }
+ if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) {
+ // config file has changed, regenerate cache
+ return false;
+ }
}
}
}
- foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
+ foreach ($_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
if (empty($smarty->_cache_serials[$_include_file_path])) {
$smarty->_include($_include_file_path, true);
}
@@ -102,8 +100,9 @@
}
}
$params['results'] = $cache_split[1];
- $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $smarty->_cache_info);
+ $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info);
+ $smarty->_cache_info = $_cache_info;
return true;
}
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php