- new feature Compiler does now observe the template_dir setting and will create separate compiled files if required

This commit is contained in:
uwetews
2015-12-24 02:29:21 +01:00
parent 9d0865aaf8
commit 297f47a15a
8 changed files with 16 additions and 7 deletions

View File

@@ -8,6 +8,12 @@ Smarty 3.1.30
======= =======
Caching does now observe the template_dir setting and will create separate cache files if required Caching does now observe the template_dir setting and will create separate cache files if required
Compiled Templates
==================
The template_dir setting is now encoded in the uid of the file name.
The content of the compiled template may depend on the template_dir search order
{include .... inline} is used or $smarty->merge_compiled_includes is enabled
Smarty 3.1.28 Smarty 3.1.28
OPCACHE OPCACHE

View File

@@ -1,4 +1,7 @@
 ===== 3.1.30-dev ===== (xx.xx.xx)  ===== 3.1.30-dev ===== (xx.xx.xx)
24.12.2015
- new feature Compiler does now observe the template_dir setting and will create separate compiled files if required
23.12.2015 23.12.2015
- optimization move internal method decodeProperties back into template object - optimization move internal method decodeProperties back into template object
- optimization move subtemplate processing back into template object - optimization move subtemplate processing back into template object

View File

@@ -23,7 +23,7 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
$uid = ''; $uid = '';
$sources = array(); $sources = array();
$timestamp = 0; $timestamp = 0;
foreach ($_template->smarty->getTemplateDir() as $key => $directory) { foreach ($source->smarty->getTemplateDir() as $key => $directory) {
try { try {
$s = Smarty_Resource::source(null, $source->smarty, 'file:' . '[' . $key . ']' . $source->name); $s = Smarty_Resource::source(null, $source->smarty, 'file:' . '[' . $key . ']' . $source->name);
if (!$s->exists) { if (!$s->exists) {
@@ -46,7 +46,7 @@ class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
$s = current($sources); $s = current($sources);
$source->components = $sources; $source->components = $sources;
$source->filepath = $s->filepath; $source->filepath = $s->filepath;
$source->uid = sha1($uid . $_template->smarty->_joined_template_dir); $source->uid = sha1($uid . $source->smarty->_joined_template_dir);
$source->exists = true; $source->exists = true;
$source->timestamp = $timestamp; $source->timestamp = $timestamp;
} }

View File

@@ -118,7 +118,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.30-dev/7'; const SMARTY_VERSION = '3.1.30-dev/8';
/** /**
* define variable scopes * define variable scopes

View File

@@ -52,7 +52,7 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
} }
$source->components = $sources; $source->components = $sources;
$source->filepath = $_s->filepath; $source->filepath = $_s->filepath;
$source->uid = sha1($uid); $source->uid = sha1($uid . $source->smarty->_joined_template_dir);
$source->exists = $exists; $source->exists = $exists;
if ($_template) { if ($_template) {
$source->timestamp = $_s->timestamp; $source->timestamp = $_s->timestamp;

View File

@@ -123,7 +123,7 @@ class Smarty_Internal_Resource_File extends Smarty_Resource
$source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig); $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
} }
$source->exists = true; $source->exists = true;
$source->uid = sha1($source->filepath); $source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : $source->smarty->_joined_template_dir));
if ($source->smarty->compile_check == 1) { if ($source->smarty->compile_check == 1) {
$source->timestamp = filemtime($source->filepath); $source->timestamp = filemtime($source->filepath);
} }

View File

@@ -29,7 +29,7 @@ class Smarty_Internal_Resource_Registered extends Smarty_Resource
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{ {
$source->filepath = $source->type . ':' . $source->name; $source->filepath = $source->type . ':' . $source->name;
$source->uid = sha1($source->filepath); $source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);
if ($source->smarty->compile_check) { if ($source->smarty->compile_check) {
$source->timestamp = $this->getTemplateTimestamp($source); $source->timestamp = $this->getTemplateTimestamp($source);
$source->exists = !!$source->timestamp; $source->exists = !!$source->timestamp;

View File

@@ -28,7 +28,7 @@ class Smarty_Internal_Resource_String extends Smarty_Resource
*/ */
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{ {
$source->uid = $source->filepath = sha1($source->name); $source->uid = $source->filepath = sha1($source->name . $source->smarty->_joined_template_dir);
$source->timestamp = 0; $source->timestamp = 0;
$source->exists = true; $source->exists = true;
} }