Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 3b43a72

Browse files
author
Jamie Snape
committed
Fix issue with database connection during installation
1 parent 5a42749 commit 3b43a72

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

core/controllers/InstallController.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ public function step2Action()
164164
}
165165

166166
$db = Zend_Db::factory($dbtype, $params);
167-
$this->Component->Utility->run_sql_from_file($db, $sqlFile);
168-
169167
Zend_Db_Table::setDefaultAdapter($db);
170168
Zend_Registry::set('dbAdapter', $db);
171169

170+
$this->Component->Utility->run_sql_from_file($db, $sqlFile);
171+
172172
// Must generate and store our password salt before we create our first user
173173
$options = array('allowModifications' => true);
174174
$applicationConfig = new Zend_Config_Ini(CORE_CONFIGS_PATH.'/application.ini', null, $options);
@@ -183,7 +183,7 @@ public function step2Action()
183183
$configGlobal = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/application.local.ini', 'global');
184184
Zend_Registry::set('configGlobal', $configGlobal);
185185

186-
$configDatabase = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/database.local.ini', $configGlobal->environment);
186+
$configDatabase = new Zend_Config_Ini(LOCAL_CONFIGS_PATH.'/database.local.ini', 'production');
187187
Zend_Registry::set('configDatabase', $configDatabase);
188188

189189
require_once BASE_PATH.'/core/controllers/components/UpgradeComponent.php';
@@ -193,7 +193,8 @@ public function step2Action()
193193
$upgradeComponent->upgrade(str_replace('.sql', '', basename($sqlFile)));
194194

195195
session_start();
196-
$userModel = MidasLoader::loadModel('User');
196+
require_once BASE_PATH.'/core/models/pdo/UserModel.php';
197+
$userModel = new UserModel();
197198
$this->userSession->Dao = $userModel->createUser(
198199
$form->getValue('email'),
199200
$form->getValue('userpassword1'),
@@ -259,7 +260,7 @@ public function step3Action()
259260
$config->global->application->name = $form->getValue('name');
260261
$config->global->default->timezone = $form->getValue('timezone');
261262
$config->global->defaultassetstore->id = $assetstores[0]->getKey();
262-
$config->global->environment = $form->getValue('environment');
263+
$config->global->environment = 'production';
263264

264265
$writer = new Zend_Config_Writer_Ini();
265266
$writer->setConfig($config);

core/models/base/UserModelBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0,
279279
}
280280

281281
// Check if the user already exists based on the email address
282-
if ($this->getByEmail($email) != null) {
282+
if ($this->getByEmail($email) !== false) {
283283
throw new Zend_Exception("User already exists.");
284284
}
285285

0 commit comments

Comments
 (0)