From 10ad4b62489a45c7a6cd2c4957c52ea1024498fa Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 2 Sep 2021 17:51:54 +1000 Subject: [PATCH] v5.3.5 --- VERSION.txt | 2 +- app/Http/Controllers/SetupController.php | 91 ++++++++++++++---------- app/Utils/SystemHealth.php | 1 + app/Utils/Traits/AppSetup.php | 6 +- config/ninja.php | 4 +- 5 files changed, 60 insertions(+), 44 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 86f2a61e3d..229793ae14 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.4 \ No newline at end of file +5.3.5 \ No newline at end of file diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 87dd6e2239..d24c17b7ec 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -73,55 +73,69 @@ class SetupController extends Controller return response('Oops, something went wrong. Check your logs.'); /* We should never reach this block, but just in case. */ } - try { - $db = SystemHealth::dbCheck($request); + // try { + // $db = SystemHealth::dbCheck($request); - if ($db['success'] == false) { - throw new Exception($db['message']); - } - } catch (Exception $e) { - return response([ - 'message' => 'Oops, connection to database was not successful.', - 'error' => $e->getMessage(), - ]); - } + // if ($db['success'] == false) { + // throw new Exception($db['message']); + // } + // } catch (Exception $e) { + // return response([ + // 'message' => 'Oops, connection to database was not successful.', + // 'error' => $e->getMessage(), + // ]); + // } - try { - if ($request->mail_driver != 'log') { - $smtp = SystemHealth::testMailServer($request); + // try { + // if ($request->mail_driver != 'log') { + // $smtp = SystemHealth::testMailServer($request); - if ($smtp['success'] == false) { - throw new Exception($smtp['message']); - } - } - } catch (Exception $e) { - return response([ - 'message' => 'Oops, connection to mail server was not successful.', - 'error' => $e->getMessage(), - ]); - } + // if ($smtp['success'] == false) { + // throw new Exception($smtp['message']); + // } + // } + // } catch (Exception $e) { + // return response([ + // 'message' => 'Oops, connection to mail server was not successful.', + // 'error' => $e->getMessage(), + // ]); + // } $mail_driver = $request->input('mail_driver'); + $url = $request->input('url'); + $db_host = $request->input('db_host'); + $db_port = $request->input('db_port'); + $db_database = $request->input('db_database'); + $db_username = $request->input('db_username'); + $db_password = $request->input('db_password'); + $mail_port = $request->input('mail_port'); + $encryption = $request->input('encryption'); + $mail_host = $request->input('mail_host'); + $mail_username = $request->input('mail_username'); + $mail_name = $request->input('mail_name'); + $mail_address = $request->input('mail_address'); + $mail_password = $request->input('mail_password'); + $env_values = [ - 'APP_URL' => $request->input('url'), + 'APP_URL' => $url, 'REQUIRE_HTTPS' => $request->input('https') ? 'true' : 'false', 'APP_DEBUG' => 'false', - 'DB_HOST' => $request->input('db_host'), - 'DB_PORT' => $request->input('db_port'), - 'DB_DATABASE' => $request->input('db_database'), - 'DB_USERNAME' => $request->input('db_username'), - 'DB_PASSWORD' => $request->input('db_password'), + 'DB_HOST' => $db_host, + 'DB_PORT' => $db_port, + 'DB_DATABASE' => $db_database, + 'DB_USERNAME' => $db_username, + 'DB_PASSWORD' => $db_password, 'MAIL_MAILER' => $mail_driver, - 'MAIL_PORT' => $request->input('mail_port'), - 'MAIL_ENCRYPTION' => $request->input('encryption'), - 'MAIL_HOST' => $request->input('mail_host'), - 'MAIL_USERNAME' => $request->input('mail_username'), - 'MAIL_FROM_NAME' => $request->input('mail_name'), - 'MAIL_FROM_ADDRESS' => $request->input('mail_address'), - 'MAIL_PASSWORD' => $request->input('mail_password'), + 'MAIL_PORT' => $mail_port, + 'MAIL_ENCRYPTION' => $encryption, + 'MAIL_HOST' => $mail_host, + 'MAIL_USERNAME' => $mail_username, + 'MAIL_FROM_NAME' => $mail_name, + 'MAIL_FROM_ADDRESS' => $mail_address, + 'MAIL_PASSWORD' => $mail_password, 'NINJA_ENVIRONMENT' => 'selfhost', 'DB_CONNECTION' => 'mysql', @@ -150,7 +164,8 @@ class SetupController extends Controller /* Make sure no stale connections are cached */ DB::purge('db-ninja-01'); - + //DB::reconnect('db-ninja-01'); + /* Run migrations */ if (!config('ninja.disable_auto_update')) { Artisan::call('optimize'); diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 175d2e575a..4e61b40a36 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -231,6 +231,7 @@ class SystemHealth config(['mail.encryption' => $request->input('encryption')]); config(['mail.username' => $request->input('mail_username')]); config(['mail.password' => $request->input('mail_password')]); + (new \Illuminate\Mail\MailServiceProvider(app()))->register(); } try { diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index 91c3cf5298..90015496f2 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -118,9 +118,9 @@ trait AppSetup private function updateEnvironmentProperty(string $property, $value): void { - if (Str::contains($value, '#')) { - $value = sprintf('"%s"', $value); - } + // if (Str::contains($value, '#')) { + // $value = sprintf('"%s"', $value); + // } $env = file(base_path('.env')); diff --git a/config/ninja.php b/config/ninja.php index 74ba6b62db..b19ae24343 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.3.4', - 'app_tag' => '5.3.4', + 'app_version' => '5.3.5', + 'app_tag' => '5.3.5', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),