- update realpath handling

This commit is contained in:
Uwe Tews
2015-06-21 13:53:52 +02:00
parent 666f7264f4
commit b64d5d26c9
5 changed files with 6 additions and 5 deletions

View File

@@ -4,6 +4,7 @@
- optimization of directory handling / build realpath - optimization of directory handling / build realpath
- optimization of filter execution - optimization of filter execution
- move registerObject / registerClass into extension - move registerObject / registerClass into extension
- update realpath handling
19.06.2015 19.06.2015
- improvement allow closures as callback at $smarty->registerFilter() https://github.com/smarty-php/smarty/issues/59 - improvement allow closures as callback at $smarty->registerFilter() https://github.com/smarty-php/smarty/issues/59

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.28-dev/5'; const SMARTY_VERSION = '3.1.28-dev/6';
/** /**
* define variable scopes * define variable scopes

View File

@@ -167,7 +167,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^'; $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
$_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0; $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
$_dir = realpath($smarty->getCacheDir()) . '/'; $_dir = $smarty->getCacheDir();
if ($_dir == '/') { //We should never want to delete this! if ($_dir == '/') { //We should never want to delete this!
return 0; return 0;
} }

View File

@@ -382,13 +382,13 @@ class Smarty_Internal_Compile_Private_Child_Block extends Smarty_Internal_Compil
// update template with original template resource of {block} // update template with original template resource of {block}
if (trim($_attr['type'], "'") == 'file') { if (trim($_attr['type'], "'") == 'file') {
$compiler->template->template_resource = 'file:' . realpath(trim($_attr['file'], "'")); $compiler->template->template_resource = 'file:' . $compiler->template->smarty->_realpath(trim($_attr['file'], "'"));
} else { } else {
$compiler->template->template_resource = trim($_attr['resource'], "'"); $compiler->template->template_resource = trim($_attr['resource'], "'");
} }
// source object // source object
unset ($compiler->template->source); unset ($compiler->template->source);
$exists = $compiler->template->source->exists; $compiler->template->loadSource();
// must merge includes // must merge includes
if ($_attr['nocache'] == true) { if ($_attr['nocache'] == true) {

View File

@@ -44,7 +44,7 @@ class Smarty_Internal_Resource_Extends extends Smarty_Resource
throw new SmartyException("Resource type {$s->type} cannot be used with the extends resource type"); throw new SmartyException("Resource type {$s->type} cannot be used with the extends resource type");
} }
$sources[$s->uid] = $s; $sources[$s->uid] = $s;
$uid .= realpath($s->filepath); $uid .= $source->smarty->_realpath($s->filepath);
if ($_template && $_template->smarty->compile_check) { if ($_template && $_template->smarty->compile_check) {
$exists = $exists && $s->exists; $exists = $exists && $s->exists;
} }