diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-18 17:26:53 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-18 17:26:53 +0000 |
commit | a8eb642053ce7484bb122cac09af352ba3b75533 (patch) | |
tree | e810dd6a44303618db58bfbde73c700dfcaf68a9 | |
parent | e264a62b731d29389ba0a4a3548070e259e373c0 (diff) | |
download | forums-a8eb642053ce7484bb122cac09af352ba3b75533.tar forums-a8eb642053ce7484bb122cac09af352ba3b75533.tar.gz forums-a8eb642053ce7484bb122cac09af352ba3b75533.tar.bz2 forums-a8eb642053ce7484bb122cac09af352ba3b75533.tar.xz forums-a8eb642053ce7484bb122cac09af352ba3b75533.zip |
let us be more strict while testing for writeable directories.
git-svn-id: file:///svn/phpbb/trunk@6602 89ea8834-ac86-4346-8a33-228a782c2dd0
-rwxr-xr-x | phpBB/install/install_install.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4acea0aae3..f4cba1be24 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -10,8 +10,7 @@ /** */ - -if ( !defined('IN_INSTALL') ) +if (!defined('IN_INSTALL')) { // Someone has tried to access the file direct. This is not a good idea, so exit exit; @@ -314,18 +313,33 @@ class install_install extends module $passed['files'] = true; 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 (!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; |