mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #5502 from lwj5/db
Allow use of `DB_DATABASE` without 1 prefix
This commit is contained in:
commit
85f12eb871
@ -47,8 +47,9 @@ class SetupController extends Controller
|
||||
{
|
||||
$check = SystemHealth::check(false);
|
||||
|
||||
if ($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::all()->first())
|
||||
if ($check['system_health'] == true && $check['simple_db_check'] && Schema::hasTable('accounts') && $account = Account::all()->first()) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
// not sure if we really need this.
|
||||
// if(File::exists(base_path('.env')))
|
||||
@ -124,20 +125,22 @@ class SetupController extends Controller
|
||||
'MAIL_PASSWORD' => $request->input('mail_password'),
|
||||
|
||||
'NINJA_ENVIRONMENT' => 'selfhost',
|
||||
'DB_CONNECTION' => 'db-ninja-01',
|
||||
];
|
||||
|
||||
if(config('ninja.preconfigured_install')){
|
||||
// Database connection was already configured. Don't let the user override it.
|
||||
unset($env_values['DB_HOST1']);
|
||||
unset($env_values['DB_PORT1']);
|
||||
unset($env_values['DB_DATABASE1']);
|
||||
unset($env_values['DB_USERNAME1']);
|
||||
unset($env_values['DB_PASSWORD1']);
|
||||
}
|
||||
if (config('ninja.db.multi_db_enabled')) {
|
||||
$env_values['DB_CONNECTION'] = 'db-ninja-01';
|
||||
}
|
||||
|
||||
if (config('ninja.preconfigured_install')) {
|
||||
// Database connection was already configured. Don't let the user override it.
|
||||
unset($env_values['DB_HOST1']);
|
||||
unset($env_values['DB_PORT1']);
|
||||
unset($env_values['DB_DATABASE1']);
|
||||
unset($env_values['DB_USERNAME1']);
|
||||
unset($env_values['DB_PASSWORD1']);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
foreach ($env_values as $property => $value) {
|
||||
$this->updateEnvironmentProperty($property, $value);
|
||||
}
|
||||
@ -149,8 +152,9 @@ class SetupController extends Controller
|
||||
DB::purge('db-ninja-01');
|
||||
|
||||
/* Run migrations */
|
||||
if(!config('ninja.disable_auto_update'))
|
||||
if (!config('ninja.disable_auto_update')) {
|
||||
Artisan::call('optimize');
|
||||
}
|
||||
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
@ -168,7 +172,6 @@ class SetupController extends Controller
|
||||
|
||||
return redirect('/');
|
||||
} catch (Exception $e) {
|
||||
|
||||
nlog($e->getMessage());
|
||||
info($e->getMessage());
|
||||
|
||||
@ -278,9 +281,13 @@ class SetupController extends Controller
|
||||
return redirect('/');
|
||||
|
||||
$cacheCompiled = base_path('bootstrap/cache/compiled.php');
|
||||
if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
|
||||
if (file_exists($cacheCompiled)) {
|
||||
unlink ($cacheCompiled);
|
||||
}
|
||||
$cacheServices = base_path('bootstrap/cache/services.php');
|
||||
if (file_exists($cacheServices)) { unlink ($cacheServices); }
|
||||
if (file_exists($cacheServices)) {
|
||||
unlink ($cacheServices);
|
||||
}
|
||||
|
||||
Artisan::call('clear-compiled');
|
||||
Artisan::call('cache:clear');
|
||||
|
@ -13,7 +13,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'db-ninja-01'),
|
||||
'default' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -35,17 +35,18 @@ return [
|
||||
|
||||
// single database setup
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST1', '127.0.0.1'),
|
||||
'database' => env('DB_DATABASE1', 'forge'),
|
||||
'username' => env('DB_USERNAME1', 'forge'),
|
||||
'password' => env('DB_PASSWORD1', ''),
|
||||
'port' => env('DB_PORT1', '3306'),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8',
|
||||
'driver' => 'mysql',
|
||||
'host' => env('DB_HOST1', env('DB_HOST', '127.0.0.1')),
|
||||
'database' => env('DB_DATABASE1', env('DB_DATABASE', 'forge')),
|
||||
'username' => env('DB_USERNAME1', env('DB_USERNAME', 'forge')),
|
||||
'password' => env('DB_PASSWORD1', env('DB_PASSWORD', '')),
|
||||
'port' => env('DB_PORT1', env('DB_PORT', '3306')),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8',
|
||||
],
|
||||
|
||||
'sqlite' => [
|
||||
@ -92,7 +93,7 @@ return [
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8',
|
||||
'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8',
|
||||
],
|
||||
|
||||
'db-ninja-02' => [
|
||||
@ -107,7 +108,7 @@ return [
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => env('DB_STRICT', false),
|
||||
'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8',
|
||||
'engine' => 'InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8',
|
||||
],
|
||||
],
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user