mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
- bugfix reverted resource caching as it could not detect template_dir changes
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -234,9 +234,6 @@ class Smarty_Internal_Utility {
|
||||
}
|
||||
}
|
||||
}
|
||||
// clear compiled cache
|
||||
Smarty_Resource::$sources = array();
|
||||
Smarty_Resource::$compileds = array();
|
||||
return $_count;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user