- bugfix reverted resource caching as it could not detect template_dir changes

This commit is contained in:
uwe.tews@googlemail.com
2011-09-16 22:31:34 +00:00
parent b6274e6ae9
commit 00d45f4d3f
3 changed files with 5 additions and 36 deletions

View File

@@ -1,4 +1,8 @@
===== Smarty 3.1 =====
===== Smarty 3.1 trunk =====
17.09.2011
- bugfix reverted resource caching as it could not detect template_dir changes
===== Smarty 3.1.0 =====
15/09/2011
- optimization of {foreach}; call internal _count() method only when "total" or "last" {foreach} properties are used

View File

@@ -234,9 +234,6 @@ class Smarty_Internal_Utility {
}
}
}
// clear compiled cache
Smarty_Resource::$sources = array();
Smarty_Resource::$compileds = array();
return $_count;
}

View File

@@ -16,16 +16,6 @@
* @subpackage TemplateResources
*/
abstract class Smarty_Resource {
/**
* cache for Smarty_Template_Source instances
* @var array
*/
public static $sources = array();
/**
* cache for Smarty_Template_Compiled instances
* @var array
*/
public static $compileds = array();
/**
* cache for Smarty_Resource instances
* @var array
@@ -319,11 +309,6 @@ abstract class Smarty_Resource {
*/
public static function load(Smarty $smarty, $resource_type)
{
// try the instance cache
if (isset(self::$resources[$resource_type])) {
return self::$resources[$resource_type];
}
// try registered resource
if (isset($smarty->registered_resources[$resource_type])) {
if ($smarty->registered_resources[$resource_type] instanceof Smarty_Resource) {
@@ -393,12 +378,6 @@ abstract class Smarty_Resource {
$template_resource = $_template->template_resource;
}
// check runtime cache
$_cache_key = 'template|' . $template_resource;
if (isset(self::$sources[$_cache_key])) {
return self::$sources[$_cache_key];
}
if (($pos = strpos($template_resource, ':')) === false) {
// no resource given, use default
$resource_type = $smarty->default_resource_type;
@@ -418,8 +397,6 @@ abstract class Smarty_Resource {
$source = new Smarty_Template_Source($resource, $smarty, $template_resource, $resource_type, $resource_name);
$resource->populate($source, $_template);
// runtime cache
self::$sources[$_cache_key] = $source;
return $source;
}
@@ -588,20 +565,11 @@ class Smarty_Template_Source {
*/
public function getCompiled(Smarty_Internal_Template $_template)
{
// check runtime cache
$_cache_key = $_template->template_resource . '#' . $_template->compile_id;
if (isset(Smarty_Resource::$compileds[$_cache_key])) {
return Smarty_Resource::$compileds[$_cache_key];
}
$compiled = new Smarty_Template_Compiled($this);
$this->handler->populateCompiledFilepath($compiled, $_template);
$compiled->timestamp = @filemtime($compiled->filepath);
$compiled->exists = !!$compiled->timestamp;
// runtime cache
Smarty_Resource::$compileds[$_cache_key] = $compiled;
return $compiled;
}