BUG Fix incorrect $database autoinit

BUG Fix missing $request in Installer bootstrapping
This commit is contained in:
Damian Mooyman 2017-06-28 17:59:16 +12:00
parent 8078ee08f2
commit b2f3b218a3
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
2 changed files with 8 additions and 5 deletions

View File

@ -318,7 +318,6 @@ class CoreKernel implements Kernel
*/ */
protected function getDatabaseConfig() protected function getDatabaseConfig()
{ {
/** @skipUpgrade */ /** @skipUpgrade */
$databaseConfig = [ $databaseConfig = [
"type" => getenv('SS_DATABASE_CLASS') ?: 'MySQLDatabase', "type" => getenv('SS_DATABASE_CLASS') ?: 'MySQLDatabase',
@ -361,7 +360,7 @@ class CoreKernel implements Kernel
*/ */
protected function getDatabasePrefix() protected function getDatabasePrefix()
{ {
return getenv('SS_DATABASE_PREFIX'); return getenv('SS_DATABASE_PREFIX') ?: '';
} }
/** /**
@ -406,8 +405,12 @@ class CoreKernel implements Kernel
$database = str_replace('.', '', basename($databaseDir)); $database = str_replace('.', '', basename($databaseDir));
$prefix = $this->getDatabasePrefix(); $prefix = $this->getDatabasePrefix();
if ($prefix === false) { if ($prefix) {
$prefix = 'SS_'; $prefix = 'SS_';
} else {
// If no prefix, hard-code prefix into database global
$prefix = '';
$database = 'SS_' . $database;
} }
return $prefix . $database; return $prefix . $database;

View File

@ -212,7 +212,7 @@ PHP
// Build db within HTTPApplication // Build db within HTTPApplication
$app->execute($request, function (HTTPRequest $request) use ($config) { $app->execute($request, function (HTTPRequest $request) use ($config) {
// Start session and execute // Start session and execute
$request->getSession()->init(); $request->getSession()->init($request);
// Output status // Output status
$this->statusMessage("Building database schema..."); $this->statusMessage("Building database schema...");
@ -242,7 +242,7 @@ PHP
$request->getSession()->set('username', $config['admin']['username']); $request->getSession()->set('username', $config['admin']['username']);
$request->getSession()->set('password', $config['admin']['password']); $request->getSession()->set('password', $config['admin']['password']);
$request->getSession()->save(); $request->getSession()->save($request);
}, true); }, true);
// Check result of install // Check result of install