From 3b43a72c5038e4a289c7aca5cbff908a1c43a7d0 Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Wed, 19 Nov 2014 14:34:01 -0500 Subject: [PATCH] Fix issue with database connection during installation --- core/controllers/InstallController.php | 11 ++++++----- core/models/base/UserModelBase.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/controllers/InstallController.php b/core/controllers/InstallController.php index bd371ae89..140b35f93 100644 --- a/core/controllers/InstallController.php +++ b/core/controllers/InstallController.php @@ -164,11 +164,11 @@ public function step2Action() } $db = Zend_Db::factory($dbtype, $params); - $this->Component->Utility->run_sql_from_file($db, $sqlFile); - Zend_Db_Table::setDefaultAdapter($db); Zend_Registry::set('dbAdapter', $db); + $this->Component->Utility->run_sql_from_file($db, $sqlFile); + // Must generate and store our password salt before we create our first user $options = array('allowModifications' => true); $applicationConfig = new Zend_Config_Ini(CORE_CONFIGS_PATH.'/application.ini', null, $options); @@ -183,7 +183,7 @@ public function step2Action() $configGlobal = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/application.local.ini', 'global'); Zend_Registry::set('configGlobal', $configGlobal); - $configDatabase = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/database.local.ini', $configGlobal->environment); + $configDatabase = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/database.local.ini', 'production'); Zend_Registry::set('configDatabase', $configDatabase); require_once BASE_PATH.'/core/controllers/components/UpgradeComponent.php'; @@ -193,7 +193,8 @@ public function step2Action() $upgradeComponent->upgrade(str_replace('.sql', '', basename($sqlFile))); session_start(); - $userModel = MidasLoader::loadModel('User'); + require_once BASE_PATH.'/core/models/pdo/UserModel.php'; + $userModel = new UserModel(); $this->userSession->Dao = $userModel->createUser( $form->getValue('email'), $form->getValue('userpassword1'), @@ -259,7 +260,7 @@ public function step3Action() $config->global->application->name = $form->getValue('name'); $config->global->default->timezone = $form->getValue('timezone'); $config->global->defaultassetstore->id = $assetstores[0]->getKey(); - $config->global->environment = $form->getValue('environment'); + $config->global->environment = 'production'; $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($config); diff --git a/core/models/base/UserModelBase.php b/core/models/base/UserModelBase.php index 353580b89..1a82483a1 100644 --- a/core/models/base/UserModelBase.php +++ b/core/models/base/UserModelBase.php @@ -279,7 +279,7 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0, } // Check if the user already exists based on the email address - if ($this->getByEmail($email) != null) { + if ($this->getByEmail($email) !== false) { throw new Zend_Exception("User already exists."); }