From 4e94efeaaa9be0cd331f694d4028f02b8b6cde1c Mon Sep 17 00:00:00 2001 From: aoneil Date: Mon, 29 Oct 2007 22:12:21 +0000 Subject: [PATCH] #1464 - PHP installer doesn't keep the admin username/password when you 'recheck requirements' git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@43975 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- config-form.html | 16 ++++++++-------- install.php | 31 +++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 18 deletions(-) diff --git a/config-form.html b/config-form.html index 7d0e355..ea8a604 100644 --- a/config-form.html +++ b/config-form.html @@ -120,14 +120,14 @@

SilverStripe Administration Account

- - - - - - - - + + + + + + + +

We will set up 1 administrator account for you automatically. Enter the email address and password. If you'd diff --git a/install.php b/install.php index 457e76b..e3eb3a4 100644 --- a/install.php +++ b/install.php @@ -17,6 +17,17 @@ if(isset($_REQUEST['mysql'])) { "password" => "", "database" => "SS_mysite", ); +} + +if(isset($_REQUEST['admin'])) { + $adminConfig = $_REQUEST['admin']; +} else { + $adminConfig = array( + 'username' => 'admin', + 'password' => 'password', + 'firstname' => '', + 'surname' => '' + ); } $alreadyInstalled = (file_exists('mysite/_config.php') || file_exists('tutorial/_config.php')); @@ -633,23 +644,23 @@ PHP ManifestBuilder::compileManifest(); $dbAdmin = new DatabaseAdmin(); $dbAdmin->init(); - + + $_REQUEST['username'] = $_REQUEST['admin']['username']; + $_REQUEST['password'] = $_REQUEST['admin']['password']; $dbAdmin->doBuild(true); - $adminmember = DataObject::get_one('Member',"`Email`= '".$_REQUEST['username']."'"); - if($adminmember){ - if($adminmember->_isAdmin()){ - $adminmember->FirstName = $_REQUEST['firstname']; - $adminmember->Surname = $_REQUEST['surname']; - $adminmember->write(); - } + $adminmember = DataObject::get_one('Member',"`Email`= '".$_REQUEST['admin']['username']."'"); + if($adminmember) { + $adminmember->FirstName = $_REQUEST['admin']['firstname']; + $adminmember->Surname = $_REQUEST['admin']['surname']; + $adminmember->write(); } echo "

  • Checking mod_rewrite works
  • "; - $_SESSION['username'] = $_REQUEST['username']; - $_SESSION['password'] = $_REQUEST['password']; + $_SESSION['username'] = $_REQUEST['admin']['username']; + $_SESSION['password'] = $_REQUEST['admin']['password']; if($this->checkModRewrite()) {