mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive
at wrong path permissions because realpath() fail (forum 25397)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
===== 3.1.22-dev ===== (xx.xx.2015)
|
===== 3.1.22-dev ===== (xx.xx.2015)
|
||||||
|
|
||||||
20.01.2015
|
21.01.2015
|
||||||
- bugfix clearCompiledTemplates() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397)
|
- bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397)
|
||||||
|
|
||||||
04.01.2015
|
04.01.2015
|
||||||
- push last weeks changes to github
|
- push last weeks changes to github
|
||||||
|
@@ -163,10 +163,10 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
|||||||
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
||||||
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
|
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
|
||||||
$_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
|
$_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
|
||||||
if (($_dir = realpath($smarty->getCacheDir())) === false) {
|
$_dir = realpath($smarty->getCacheDir()) . '/';
|
||||||
|
if ($_dir == '/') { //We should never want to delete this!
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$_dir .= '/';
|
|
||||||
$_dir_length = strlen($_dir);
|
$_dir_length = strlen($_dir);
|
||||||
if (isset($_cache_id)) {
|
if (isset($_cache_id)) {
|
||||||
$_cache_id_parts = explode('|', $_cache_id);
|
$_cache_id_parts = explode('|', $_cache_id);
|
||||||
|
@@ -191,10 +191,10 @@ class Smarty_Internal_Utility
|
|||||||
*/
|
*/
|
||||||
public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
|
public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
|
||||||
{
|
{
|
||||||
if (($_compile_dir = realpath($smarty->getCompileDir())) === false) {
|
$_compile_dir = realpath($smarty->getCompileDir()) . '/';
|
||||||
|
if ($_compile_dir == '/') { //We should never want to delete this!
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
$_compile_dir .= '/';
|
|
||||||
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
|
||||||
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
|
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
|
||||||
if (isset($resource_name)) {
|
if (isset($resource_name)) {
|
||||||
|
Reference in New Issue
Block a user