From 7f00b38f34931a6ae0422463e183222155642403 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Sat, 28 Mar 2009 09:41:06 +0000 Subject: [PATCH] - md5 hash function replace with crc32 for speed optimization --- change_log.txt | 1 + libs/sysplugins/internal.cacheresource_file.php | 5 +++-- libs/sysplugins/internal.resource_extend.php | 3 ++- libs/sysplugins/internal.resource_file.php | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 2c334743..602794e3 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,5 @@ 03/28/2009 +- md5 hash function replace with crc32 for speed optimization - file order for exted resource inverted - clear_compiled_tpl and clear_cache_all will not touch .svn folder any longer diff --git a/libs/sysplugins/internal.cacheresource_file.php b/libs/sysplugins/internal.cacheresource_file.php index 05928c2c..5ec9a35e 100644 --- a/libs/sysplugins/internal.cacheresource_file.php +++ b/libs/sysplugins/internal.cacheresource_file.php @@ -90,7 +90,7 @@ class Smarty_Internal_CacheResource_File extends Smarty_Internal_PluginBase { { $_dir_sep = $this->smarty->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; if (isset($resource_name)) { - $_resource_part = md5($resource_name) . '.' . $resource_name . $this->smarty->php_ext; + $_resource_part = (string)sprintf("%u",crc32($resource_name)) . '.' . $resource_name . $this->smarty->php_ext; } else { $_resource_part = null; } @@ -144,7 +144,8 @@ class Smarty_Internal_CacheResource_File extends Smarty_Internal_PluginBase { */ private function buildCachedFilepath ($resource_name, $cache_id, $compile_id) { - $_filepath = md5($resource_name); +// $_filepath = md5($resource_name); + $_filepath = (string)sprintf("%u",crc32($resource_name)); // if use_sub_dirs, break file into directories if ($this->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 2) . DIRECTORY_SEPARATOR diff --git a/libs/sysplugins/internal.resource_extend.php b/libs/sysplugins/internal.resource_extend.php index a69c2354..ec584d83 100644 --- a/libs/sysplugins/internal.resource_extend.php +++ b/libs/sysplugins/internal.resource_extend.php @@ -126,7 +126,8 @@ class Smarty_Internal_Resource_Extend extends Smarty_Internal_Base { public function getCompiledFilepath($_template) { $_files = explode('|', $_template->resource_name); - $_filepath = md5($_files[0]); +// $_filepath = md5($_files[0]); + $_filepath = (string)sprintf("%u",crc32($_files[0])); // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR diff --git a/libs/sysplugins/internal.resource_file.php b/libs/sysplugins/internal.resource_file.php index 57eb76ed..5b3ecd15 100644 --- a/libs/sysplugins/internal.resource_file.php +++ b/libs/sysplugins/internal.resource_file.php @@ -92,7 +92,8 @@ class Smarty_Internal_Resource_File extends Smarty_Internal_Base { */ public function getCompiledFilepath($_template) { - $_filepath = md5($_template->resource_name); +// $_filepath = md5($_template->resource_name); + $_filepath = (string)sprintf("%u",crc32($_template->resource_name)); // if use_sub_dirs, break file into directories if ($_template->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 3) . DIRECTORY_SEPARATOR