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
This commit is contained in:
sminnee 2010-07-15 22:53:49 +00:00 committed by Sam Minnee
parent 943336b1af
commit edfdf48bee

View File

@ -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]'. ";