Fix potential issues with the stat cache and phpbb_chmod()

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9144 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Chris Smith 2008-12-01 17:04:11 +00:00
parent eac61e53f6
commit 5474fcc4ea

View file

@ -511,6 +511,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
// Will most likely not work // Will most likely not work
if (@chown($filename, $common_php_owner)); if (@chown($filename, $common_php_owner));
{ {
clearstatcache(false, $filename);
$file_uid = fileowner($filename); $file_uid = fileowner($filename);
} }
} }
@ -520,6 +521,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
{ {
if (@chgrp($filename, $common_php_group)); if (@chgrp($filename, $common_php_group));
{ {
clearstatcache(false, $filename);
$file_gid = filegroup($filename); $file_gid = filegroup($filename);
} }
} }
@ -568,6 +570,8 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
$result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0)); $result = @chmod($filename, ($owner << 6) + (0 << 3) + (0 << 0));
clearstatcache(false, $filename);
if (!is_null($php) || (is_readable($filename) && is_writable($filename))) if (!is_null($php) || (is_readable($filename) && is_writable($filename)))
{ {
break; break;
@ -577,6 +581,8 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
case 'group': case 'group':
$result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0)); $result = @chmod($filename, ($owner << 6) + ($perms << 3) + (0 << 0));
clearstatcache(false, $filename);
if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))) if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))))
{ {
break; break;
@ -585,6 +591,8 @@ function phpbb_chmod($filename, $perms = CHMOD_READ)
case 'other': case 'other':
$result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0)); $result = @chmod($filename, ($owner << 6) + ($perms << 3) + ($perms << 0));
clearstatcache(false, $filename);
if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename)))) if (!is_null($php) || ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))))
{ {
break; break;