From c352723ec9600e16e6bf1d47f0892ac62f0c66f8 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Fri, 20 Jan 2012 14:47:01 +0000 Subject: [PATCH] - bugfix typo in Smarty_Internal_Get_IncludePath did cause runtime overhead (Issue 74) - improvment remove unneeded assigments (Issue 75 and 76) --- change_log.txt | 6 +++++- libs/sysplugins/smarty_cacheresource_custom.php | 11 +++++------ libs/sysplugins/smarty_internal_get_include_path.php | 4 ++-- libs/sysplugins/smarty_internal_utility.php | 2 -- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/change_log.txt b/change_log.txt index b373725a..f89757b1 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,5 +1,9 @@ ===== trunk ===== -02.01.2011 +13.01.2012 +- bugfix typo in Smarty_Internal_Get_IncludePath did cause runtime overhead (Issue 74) +- improvment remove unneeded assigments (Issue 75 and 76) + +02.01.2012 - bugfix {block foo nocache} did not load plugins within child {block} in nocache mode (Forum Topic 20753) 29.12.2011 diff --git a/libs/sysplugins/smarty_cacheresource_custom.php b/libs/sysplugins/smarty_cacheresource_custom.php index 16fe72e1..ee9de157 100644 --- a/libs/sysplugins/smarty_cacheresource_custom.php +++ b/libs/sysplugins/smarty_cacheresource_custom.php @@ -184,7 +184,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { $this->cache = array(); return $this->delete($resource_name, $cache_id, $compile_id, $exp_time); } - + /** * Check is cache is locked for this template * @@ -196,12 +196,12 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { { $id = $cached->filepath; $name = $cached->source->name . '.lock'; - + $mtime = $this->fetchTimestamp($id, $name, null, null); if ($mtime === null) { $this->fetch($id, $name, null, null, $content, $mtime); } - + return $mtime && time() - $mtime < $smarty->locking_timeout; } @@ -214,7 +214,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached) { $cached->is_locked = true; - + $id = $cached->filepath; $name = $cached->source->name . '.lock'; $this->save($id, $name, null, null, $smarty->locking_timeout, ''); @@ -229,8 +229,7 @@ abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource { public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached) { $cached->is_locked = false; - - $id = $cached->filepath; + $name = $cached->source->name . '.lock'; $this->delete($name, null, null, null); } diff --git a/libs/sysplugins/smarty_internal_get_include_path.php b/libs/sysplugins/smarty_internal_get_include_path.php index 7a9739e9..00e1a9a3 100644 --- a/libs/sysplugins/smarty_internal_get_include_path.php +++ b/libs/sysplugins/smarty_internal_get_include_path.php @@ -25,7 +25,7 @@ class Smarty_Internal_Get_Include_Path { { static $_include_path = null; - if ($_path_array === null) { + if ($_include_path === null) { $_include_path = explode(PATH_SEPARATOR, get_include_path()); } @@ -34,7 +34,7 @@ class Smarty_Internal_Get_Include_Path { return $_path . DS . $filepath; } } - + return false; } diff --git a/libs/sysplugins/smarty_internal_utility.php b/libs/sysplugins/smarty_internal_utility.php index 3e3e85f6..5e742034 100644 --- a/libs/sysplugins/smarty_internal_utility.php +++ b/libs/sysplugins/smarty_internal_utility.php @@ -211,8 +211,6 @@ class Smarty_Internal_Utility { $_resource_part_2 = str_replace('.php','.cache.php',$_resource_part_1); $_resource_part_2_length = strlen($_resource_part_2); - } else { - $_resource_part = ''; } $_dir = $_compile_dir; if ($smarty->use_sub_dirs && isset($_compile_id)) {