diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-02-23 11:45:38 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-02-23 11:45:38 +0000 |
commit | b5a1ddffa0b424d4e8d6b7b08cbbf3eec3d264bb (patch) | |
tree | 0e6967ea00de7268930b518b7b8633484903b204 /phpBB/includes/acm/acm_file.php | |
parent | 0a5c435102dbdfce9b773c5ba4c0a91e42141108 (diff) | |
download | forums-b5a1ddffa0b424d4e8d6b7b08cbbf3eec3d264bb.tar forums-b5a1ddffa0b424d4e8d6b7b08cbbf3eec3d264bb.tar.gz forums-b5a1ddffa0b424d4e8d6b7b08cbbf3eec3d264bb.tar.bz2 forums-b5a1ddffa0b424d4e8d6b7b08cbbf3eec3d264bb.tar.xz forums-b5a1ddffa0b424d4e8d6b7b08cbbf3eec3d264bb.zip |
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
Diffstat (limited to 'phpBB/includes/acm/acm_file.php')
-rw-r--r-- | phpBB/includes/acm/acm_file.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 775e8d4495..5851016f3d 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -312,7 +312,7 @@ class acm 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])) { @@ -375,7 +375,7 @@ class acm } 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; } @@ -489,13 +489,15 @@ class acm /** * 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. trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); } + + return @unlink($filename); } } |