From edfdf48bee11532bdccd4db5e00826287a4f4014 Mon Sep 17 00:00:00 2001 From: sminnee Date: Thu, 15 Jul 2010 22:53:49 +0000 Subject: [PATCH] BUGFIX: Don't allow reinstalling without first making the user manually delete mysite/_config.php git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@108030 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- install.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/install.php b/install.php index 3f92cc6..c638b72 100644 --- a/install.php +++ b/install.php @@ -192,7 +192,7 @@ if($installFromCli && ($req->hasErrors() || $dbReq->hasErrors())) { if((isset($_REQUEST['go']) || $installFromCli) && !$req->hasErrors() && !$dbReq->hasErrors() && $adminConfig['username'] && $adminConfig['password']) { // Confirm before reinstalling - if(!isset($_REQUEST['force_reinstall']) && !$installFromCli && $alreadyInstalled) { + if(!$installFromCli && $alreadyInstalled) { include('sapphire/dev/install/config-form.html'); } else { @@ -570,12 +570,15 @@ class InstallRequirements { $this->testing($testDetails); $filename = $this->getBaseDir() . str_replace("/", DIRECTORY_SEPARATOR,$filename); - if(!is_writeable($filename)) { + if(file_exists($filename)) $isWriteable = is_writeable($filename); + else $isWriteable = is_writeable(dirname($filename)); + + if(!$isWriteable) { if(function_exists('posix_getgroups')) { $userID = posix_geteuid(); $user = posix_getpwuid($userID); - $currentOwnerID = fileowner($filename); + $currentOwnerID = fileowner(file_exists($filename) ? $filename : dirname($filename) ); $currentOwner = posix_getpwuid($currentOwnerID); $testDetails[2] .= "User '$user[name]' needs to be able to write to this file:\n$filename\n\nThe file is currently owned by '$currentOwner[name]'. ";