mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- remove Smarty::$resource_cache_mode property
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||||
|
01.01.2016
|
||||||
|
- remove Smarty::$resource_cache_mode property
|
||||||
|
|
||||||
31.12.2015
|
31.12.2015
|
||||||
- optimization of {assign}, {if} and {while} compiled code
|
- optimization of {assign}, {if} and {while} compiled code
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.30-dev/14';
|
const SMARTY_VERSION = '3.1.30-dev/15';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
@@ -209,6 +209,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resource caching modes
|
* Resource caching modes
|
||||||
|
* (not used since 3.1.30)
|
||||||
*/
|
*/
|
||||||
const RESOURCE_CACHE_OFF = 0;
|
const RESOURCE_CACHE_OFF = 0;
|
||||||
|
|
||||||
@@ -565,13 +566,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*/
|
*/
|
||||||
public $default_config_type = 'file';
|
public $default_config_type = 'file';
|
||||||
|
|
||||||
/**
|
|
||||||
* enable resource caching
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
public $resource_cache_mode = 1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check If-Modified-Since headers
|
* check If-Modified-Since headers
|
||||||
*
|
*
|
||||||
@@ -682,9 +676,9 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private $obsoleteProperties = array('resource_caching', 'template_resource_caching',
|
private $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security',
|
||||||
'direct_access_security', '_dir_perms', '_file_perms',
|
'_dir_perms', '_file_perms', 'plugin_search_order',
|
||||||
'plugin_search_order', 'inheritance_merge_compiled_includes');
|
'inheritance_merge_compiled_includes', 'resource_cache_mode',);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of private properties which will call getter/setter on a direct access
|
* List of private properties which will call getter/setter on a direct access
|
||||||
|
@@ -28,31 +28,12 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
*/
|
*/
|
||||||
static function load($_template)
|
static function load($_template)
|
||||||
{
|
{
|
||||||
// check runtime cache
|
|
||||||
if (!$_template->source->handler->recompiled &&
|
|
||||||
($_template->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)
|
|
||||||
) {
|
|
||||||
$_cache_key = $_template->source->unique_resource . '#';
|
|
||||||
if ($_template->caching) {
|
|
||||||
$_cache_key .= 'caching#';
|
|
||||||
}
|
|
||||||
$_cache_key .= $_template->compile_id;
|
|
||||||
if (isset($_template->source->compileds[$_cache_key])) {
|
|
||||||
return $_template->source->compileds[$_cache_key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$compiled = new Smarty_Template_Compiled();
|
$compiled = new Smarty_Template_Compiled();
|
||||||
if ($_template->source->handler->hasCompiledHandler) {
|
if ($_template->source->handler->hasCompiledHandler) {
|
||||||
$_template->source->handler->populateCompiledFilepath($compiled, $_template);
|
$_template->source->handler->populateCompiledFilepath($compiled, $_template);
|
||||||
} else {
|
} else {
|
||||||
$compiled->populateCompiledFilepath($_template);
|
$compiled->populateCompiledFilepath($_template);
|
||||||
}
|
}
|
||||||
// runtime cache
|
|
||||||
if (!$_template->source->handler->recompiled &&
|
|
||||||
($_template->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)
|
|
||||||
) {
|
|
||||||
$_template->source->compileds[$_cache_key] = $compiled;
|
|
||||||
}
|
|
||||||
return $compiled;
|
return $compiled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,7 +91,6 @@ class Smarty_Template_Config extends Smarty_Template_Source
|
|||||||
if (!$source->exists && isset($_template->smarty->default_config_handler_func)) {
|
if (!$source->exists && isset($_template->smarty->default_config_handler_func)) {
|
||||||
Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
|
Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
|
||||||
}
|
}
|
||||||
$source->unique_resource = $resource->buildUniqueResourceName($_template->smarty, $name, true);
|
|
||||||
return $source;
|
return $source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,13 +39,6 @@ class Smarty_Template_Source
|
|||||||
*/
|
*/
|
||||||
public $name = null;
|
public $name = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Unique Resource Name
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $unique_resource = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source Filepath
|
* Source Filepath
|
||||||
*
|
*
|
||||||
@@ -102,13 +95,6 @@ class Smarty_Template_Source
|
|||||||
*/
|
*/
|
||||||
public $isConfig = false;
|
public $isConfig = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* cache for Smarty_Template_Compiled instances
|
|
||||||
*
|
|
||||||
* @var Smarty_Template_Compiled[]
|
|
||||||
*/
|
|
||||||
public $compileds = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template source content eventually set by default handler
|
* Template source content eventually set by default handler
|
||||||
*
|
*
|
||||||
@@ -170,40 +156,12 @@ class Smarty_Template_Source
|
|||||||
$handler = isset($smarty->_cache['resource_handlers'][$type]) ?
|
$handler = isset($smarty->_cache['resource_handlers'][$type]) ?
|
||||||
$smarty->_cache['resource_handlers'][$type] :
|
$smarty->_cache['resource_handlers'][$type] :
|
||||||
Smarty_Resource::load($smarty, $type);
|
Smarty_Resource::load($smarty, $type);
|
||||||
// if resource is not recompiling and resource name is not dotted we can check the source cache
|
|
||||||
if (($smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON) && !$handler->recompiled &&
|
|
||||||
!(isset($name[1]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/'))
|
|
||||||
) {
|
|
||||||
$unique_resource = $handler->buildUniqueResourceName($smarty, $name);
|
|
||||||
if (isset($smarty->_cache['source_objects'][$unique_resource])) {
|
|
||||||
return $smarty->_cache['source_objects'][$unique_resource];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$unique_resource = null;
|
|
||||||
}
|
|
||||||
// create new source object
|
// create new source object
|
||||||
$source = new Smarty_Template_Source($handler, $smarty, $template_resource, $type, $name);
|
$source = new Smarty_Template_Source($handler, $smarty, $template_resource, $type, $name);
|
||||||
$handler->populate($source, $_template);
|
$handler->populate($source, $_template);
|
||||||
if (!$source->exists && isset($_template->smarty->default_template_handler_func)) {
|
if (!$source->exists && isset($_template->smarty->default_template_handler_func)) {
|
||||||
Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
|
Smarty_Internal_Method_RegisterDefaultTemplateHandler::_getDefaultTemplate($source);
|
||||||
}
|
}
|
||||||
// on recompiling resources we are done
|
|
||||||
if (($smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON) && !$handler->recompiled) {
|
|
||||||
// may by we have already $unique_resource
|
|
||||||
$is_relative = false;
|
|
||||||
if (!isset($unique_resource)) {
|
|
||||||
$is_relative = isset($name[1]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/') &&
|
|
||||||
($type == 'file' ||
|
|
||||||
(isset($_template->parent->source) && $_template->parent->source->type == 'extends'));
|
|
||||||
$unique_resource =
|
|
||||||
$handler->buildUniqueResourceName($smarty, $is_relative ? $source->filepath . $name : $name);
|
|
||||||
}
|
|
||||||
$source->unique_resource = $unique_resource;
|
|
||||||
// save in runtime cache if not relative
|
|
||||||
if (!$is_relative) {
|
|
||||||
$smarty->_cache['source_objects'][$unique_resource] = $source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $source;
|
return $source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user