clear internal _is_file_cache when plugins_dir was modified

This commit is contained in:
Uwe Tews
2014-12-27 23:06:04 +01:00
parent 5e4f55d121
commit 49a3427515
2 changed files with 8 additions and 5 deletions

View File

@@ -1,4 +1,7 @@
===== 3.1.22-dev ===== (xx.xx.2014) ===== 3.1.22-dev ===== (xx.xx.2014)
27.12.2014
- bugfix clear internal _is_file_cache when plugins_dir was modified
13.12.2014 13.12.2014
- improvement optimization of lexer and parser resulting in a up to 30% higher compiling speed - improvement optimization of lexer and parser resulting in a up to 30% higher compiling speed

View File

@@ -650,7 +650,7 @@ class Smarty extends Smarty_Internal_TemplateBase
* *
* @var array * @var array
*/ */
public static $_is_file_cache = array(); public $_is_file_cache = array();
/**#@-*/ /**#@-*/
@@ -1041,7 +1041,7 @@ class Smarty extends Smarty_Internal_TemplateBase
foreach ((array) $plugins_dir as $k => $v) { foreach ((array) $plugins_dir as $k => $v) {
$this->plugins_dir[$k] = rtrim($v, '/\\') . DS; $this->plugins_dir[$k] = rtrim($v, '/\\') . DS;
} }
$this->_is_file_cache = array();
return $this; return $this;
} }
@@ -1073,7 +1073,7 @@ class Smarty extends Smarty_Internal_TemplateBase
} }
$this->plugins_dir = array_unique($this->plugins_dir); $this->plugins_dir = array_unique($this->plugins_dir);
$this->_is_file_cache = array();
return $this; return $this;
} }
@@ -1374,7 +1374,7 @@ class Smarty extends Smarty_Internal_TemplateBase
// if type is "internal", get plugin from sysplugins // if type is "internal", get plugin from sysplugins
if (strtolower($_name_parts[1]) == 'internal') { if (strtolower($_name_parts[1]) == 'internal') {
$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php'; $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
if (isset(self::$_is_file_cache[$file]) ? self::$_is_file_cache[$file] : self::$_is_file_cache[$file] = is_file($file)) { if (isset($this->_is_file_cache[$file]) ? $this->_is_file_cache[$file] : $this->_is_file_cache[$file] = is_file($file)) {
require_once($file); require_once($file);
return $file; return $file;
} else { } else {
@@ -1393,7 +1393,7 @@ class Smarty extends Smarty_Internal_TemplateBase
$_plugin_dir . strtolower($_plugin_filename), $_plugin_dir . strtolower($_plugin_filename),
); );
foreach ($names as $file) { foreach ($names as $file) {
if (isset(self::$_is_file_cache[$file]) ? self::$_is_file_cache[$file] : self::$_is_file_cache[$file] = is_file($file)) { if (isset($this->_is_file_cache[$file]) ? $this->_is_file_cache[$file] : $this->_is_file_cache[$file] = is_file($file)) {
require_once($file); require_once($file);
return $file; return $file;
} }