From c23ce16cafb826c8bb4fe7aaf2a5525b29052b23 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 6 Dec 2015 20:12:05 +0100 Subject: update smarty library - seems to bring some performance improvement --- .../sysplugins/smarty_internal_resource_php.php | 59 ++++++++-------------- 1 file changed, 20 insertions(+), 39 deletions(-) (limited to 'library/Smarty/libs/sysplugins/smarty_internal_resource_php.php') diff --git a/library/Smarty/libs/sysplugins/smarty_internal_resource_php.php b/library/Smarty/libs/sysplugins/smarty_internal_resource_php.php index 7463c2960..c836d1b26 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_resource_php.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_resource_php.php @@ -9,8 +9,14 @@ * @author Uwe Tews * @author Rodney Rehm */ -class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled +class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File { + /** + * Flag that it's an uncompiled resource + * + * @var bool + */ + public $uncompiled = true; /** * container for short_open_tag directive's value before executing PHP templates * @@ -27,44 +33,6 @@ class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled $this->short_open_tag = ini_get('short_open_tag'); } - /** - * populate Source Object with meta data from Resource - * - * @param Smarty_Template_Source $source source object - * @param Smarty_Internal_Template $_template template object - * - * @return void - */ - public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) - { - $source->filepath = $this->buildFilepath($source, $_template); - - if ($source->filepath !== false) { - if (is_object($source->smarty->security_policy)) { - $source->smarty->security_policy->isTrustedResourceDir($source->filepath); - } - - $source->uid = sha1($source->filepath); - if ($source->smarty->compile_check) { - $source->timestamp = @filemtime($source->filepath); - $source->exists = !!$source->timestamp; - } - } - } - - /** - * populate Source Object with timestamp and exists from Resource - * - * @param Smarty_Template_Source $source source object - * - * @return void - */ - public function populateTimestamp(Smarty_Template_Source $source) - { - $source->timestamp = @filemtime($source->filepath); - $source->exists = !!$source->timestamp; - } - /** * Load template's source from file into current template object * @@ -116,4 +84,17 @@ class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled include($source->filepath); ini_set('short_open_tag', $this->short_open_tag); } + + /** + * populate compiled object with compiled filepath + * + * @param Smarty_Template_Compiled $compiled compiled object + * @param Smarty_Internal_Template $_template template object (is ignored) + */ + public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template) + { + $compiled->filepath = false; + $compiled->timestamp = false; + $compiled->exists = false; + } } -- cgit v1.2.3