- optimize Smarty::templateExists()

This commit is contained in:
uwetews
2015-08-23 05:15:05 +02:00
parent fb83a888f3
commit 1ae11c26c0
2 changed files with 4 additions and 8 deletions

View File

@@ -10,6 +10,7 @@
- optimize rendering - optimize rendering
- move caching to Smarty::_cache - move caching to Smarty::_cache
- remove properties with redundant content - remove properties with redundant content
- optimize Smarty::templateExists()
06.08.2015 06.08.2015
- avoid possible circular object references caused by parser/lexer objects - avoid possible circular object references caused by parser/lexer objects

View File

@@ -737,14 +737,9 @@ class Smarty extends Smarty_Internal_TemplateBase
*/ */
public function templateExists($resource_name) public function templateExists($resource_name)
{ {
// create template object // create source object
$save = $this->_cache['template_objects']; $source = Smarty_Template_Source::load(null, $this, $resource_name);
$tpl = new $this->template_class($resource_name, $this); return $source->exists;
// check if it does exists
$result = $tpl->source->exists;
$this->_cache['template_objects'] = $save;
return $result;
} }
/** /**