Do not rely on parameter returned by unlink() for verifying cache directory write permission - #19565

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8388 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-02-23 11:45:38 +00:00
parent 0a5c435102
commit b5a1ddffa0
2 changed files with 7 additions and 4 deletions

View file

@ -123,6 +123,7 @@
<li>[Fix] Many minor and/or cosmetic fixes (Including, but not limited to: #21315, #18575, #18435, #21215)</li> <li>[Fix] Many minor and/or cosmetic fixes (Including, but not limited to: #21315, #18575, #18435, #21215)</li>
<li>[Feature] New option to hide the entire list of subforums on listforums</li> <li>[Feature] New option to hide the entire list of subforums on listforums</li>
<li>[Fix] Custom BBCode {EMAIL}-Token usage (Bug #21155)</li> <li>[Fix] Custom BBCode {EMAIL}-Token usage (Bug #21155)</li>
<li>[Fix] Do not rely on parameter returned by unlink() for verifying cache directory write permission (Bug #19565)</li>
</ul> </ul>

View file

@ -312,7 +312,7 @@ class acm
if ($var_name[0] == '_') if ($var_name[0] == '_')
{ {
$this->remove_file($this->cache_dir . 'data' . $var_name . ".$phpEx"); $this->remove_file($this->cache_dir . 'data' . $var_name . ".$phpEx", true);
} }
else if (isset($this->vars[$var_name])) else if (isset($this->vars[$var_name]))
{ {
@ -375,7 +375,7 @@ class acm
} }
else if ($expired) else if ($expired)
{ {
$this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx"); $this->remove_file($this->cache_dir . 'sql_' . md5($query) . ".$phpEx", true);
return false; return false;
} }
@ -489,13 +489,15 @@ class acm
/** /**
* Removes/unlinks file * Removes/unlinks file
*/ */
function remove_file($filename) function remove_file($filename, $check = false)
{ {
if (!@unlink($filename)) if ($check && !@is_writeable($this->cache_dir))
{ {
// E_USER_ERROR - not using language entry - intended. // E_USER_ERROR - not using language entry - intended.
trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
} }
return @unlink($filename);
} }
} }