mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
- fixed cache filename for custom resources
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
12/29/2009
|
12/29/2009
|
||||||
- use sha1() for filepath encoding
|
- use sha1() for filepath encoding
|
||||||
- updates on nocache_hash handling
|
- updates on nocache_hash handling
|
||||||
- internal change on merging some data
|
- internal change on merging some data
|
||||||
|
- fixed cache filename for custom resources
|
||||||
|
|
||||||
12/28/2009
|
12/28/2009
|
||||||
- update for security fixes
|
- update for security fixes
|
||||||
|
@@ -37,8 +37,8 @@ class Smarty_Internal_CacheResource_File {
|
|||||||
* @return integer |booelan the template timestamp or false if the file does not exist
|
* @return integer |booelan the template timestamp or false if the file does not exist
|
||||||
*/
|
*/
|
||||||
public function getCachedTimestamp($template)
|
public function getCachedTimestamp($template)
|
||||||
{
|
{
|
||||||
//return @filemtime($template->getCachedFilepath());
|
// return @filemtime ($template->getCachedFilepath());
|
||||||
return ($template->getCachedFilepath() && file_exists($template->getCachedFilepath())) ? filemtime($template->getCachedFilepath()) : false ;
|
return ($template->getCachedFilepath() && file_exists($template->getCachedFilepath())) ? filemtime($template->getCachedFilepath()) : false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,9 +161,10 @@ class Smarty_Internal_CacheResource_File {
|
|||||||
*/
|
*/
|
||||||
private function buildCachedFilepath ($source_file_path, $cache_id, $compile_id)
|
private function buildCachedFilepath ($source_file_path, $cache_id, $compile_id)
|
||||||
{
|
{
|
||||||
|
$_source_file_path = str_replace(':', '.', $source_file_path);
|
||||||
$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
|
$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
|
||||||
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
||||||
$_filepath = sha1($source_file_path);
|
$_filepath = sha1($_source_file_path);
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($this->smarty->use_sub_dirs) {
|
if ($this->smarty->use_sub_dirs) {
|
||||||
$_filepath = substr($_filepath, 0, 2) . DS
|
$_filepath = substr($_filepath, 0, 2) . DS
|
||||||
@@ -186,7 +187,7 @@ class Smarty_Internal_CacheResource_File {
|
|||||||
if (strpos('/\\', substr($_cache_dir, -1)) === false) {
|
if (strpos('/\\', substr($_cache_dir, -1)) === false) {
|
||||||
$_cache_dir .= DS;
|
$_cache_dir .= DS;
|
||||||
}
|
}
|
||||||
return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($source_file_path) . '.php';
|
return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user