let us be more strict while testing for writeable directories.

git-svn-id: file:///svn/phpbb/trunk@6602 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2006-11-18 17:26:53 +00:00
parent e264a62b73
commit a8eb642053

View file

@ -10,7 +10,6 @@
/** /**
*/ */
if (!defined('IN_INSTALL')) if (!defined('IN_INSTALL'))
{ {
// Someone has tried to access the file direct. This is not a good idea, so exit // Someone has tried to access the file direct. This is not a good idea, so exit
@ -314,18 +313,33 @@ class install_install extends module
$passed['files'] = true; $passed['files'] = true;
foreach ($directories as $dir) foreach ($directories as $dir)
{ {
$write = $exists = true; $exists = $write = false;
// Try to create the directory if it does not exist
if (!file_exists($phpbb_root_path . $dir))
{
@mkdir($phpbb_root_path . $dir, 0777);
@chmod($phpbb_root_path . $dir, 0777);
}
// Now really check
if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir)) if (file_exists($phpbb_root_path . $dir) && is_dir($phpbb_root_path . $dir))
{ {
if (!is_writeable($phpbb_root_path . $dir)) if (!is_writeable($phpbb_root_path . $dir))
{ {
$write = (@chmod($phpbb_root_path . $dir, 0777)) ? true : false; @chmod($phpbb_root_path . $dir, 0777);
} }
$exists = true;
} }
else
// Now check if it is writeable by storing a simple file
$fp = @fopen($phpbb_root_path . $dir . 'test_lock', 'wb');
if ($fp !== false)
{ {
$write = $exists = (@mkdir($phpbb_root_path . $dir, 0777)) ? true : false; @unlink($phpbb_root_path . $dir . 'test_lock');
$write = true;
} }
@fclose($fp);
$passed['files'] = ($exists && $write && $passed['files']) ? true : false; $passed['files'] = ($exists && $write && $passed['files']) ? true : false;