From ba6c1571288c69f653f1bdbbd4f151ed1d170797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sun, 29 Nov 2020 13:54:12 +0100 Subject: [PATCH 1/4] Surround multiple words with quotes in env file --- app/Utils/Traits/AppSetup.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index debd5750c..f60d31a09 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -128,13 +128,14 @@ trait AppSetup } } - // This should never happen, but this is login just in case. - // Variables that will be replaced (updated with different content) should already be in .env file. + $words_count = count(explode(' ', trim($value))); if (is_null($position)) { - $env[] = "{$property}=" . $value . "\n"; + $env[] = "{$property}=" . $value . "\n"; // If we don't have entry for variable in the .env, write it. + } else if ($words_count > 1) { + $env[$position] = "{$property}=" . '"' . $value . '"' . "\n"; // If value of variable is more than one word, surround with quotes. } else { - $env[$position] = "{$property}=" . $value . "\n"; + $env[$position] = "{$property}=" . $value . "\n"; // Just a normal variable update, with prexisting keys. } try { From d888780ed878cfd15e17d3189feb6a0919a1701d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sun, 29 Nov 2020 14:20:47 +0100 Subject: [PATCH 2/4] update quotes logic --- app/Utils/Traits/AppSetup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Utils/Traits/AppSetup.php b/app/Utils/Traits/AppSetup.php index f60d31a09..8b7d80c21 100644 --- a/app/Utils/Traits/AppSetup.php +++ b/app/Utils/Traits/AppSetup.php @@ -131,7 +131,7 @@ trait AppSetup $words_count = count(explode(' ', trim($value))); if (is_null($position)) { - $env[] = "{$property}=" . $value . "\n"; // If we don't have entry for variable in the .env, write it. + $words_count > 1 ? $env[] = "{$property}=" . '"' . $value . '"' . "\n" : $env[] = "{$property}=" . $value . "\n"; } else if ($words_count > 1) { $env[$position] = "{$property}=" . '"' . $value . '"' . "\n"; // If value of variable is more than one word, surround with quotes. } else { From d7dd592d1887ca8d1682dc46e9c93307182fd01c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 30 Nov 2020 08:28:12 +1100 Subject: [PATCH 3/4] Fixes for migration file location --- app/Http/Controllers/MigrationController.php | 7 +++++-- app/Jobs/Util/StartMigration.php | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index ca17e3970..35f691762 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -320,7 +320,8 @@ class MigrationController extends BaseController $migration_file = $request->file($company->company_index) ->storeAs( 'migrations', - $request->file($company->company_index)->getClientOriginalName() + $request->file($company->company_index)->getClientOriginalName(), + 'local' ); if (app()->environment() == 'testing') { @@ -328,7 +329,9 @@ class MigrationController extends BaseController } try { - StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $fresh_company)->delay(now()->addSeconds(5)); + // StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $fresh_company)->delay(now()->addSeconds(5)); + info($migration_file); + StartMigration::dispatch($migration_file, $user, $fresh_company); } catch (\Exception $e) { info($e->getMessage()); } diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index 78eabfe60..17cefe69e 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -85,8 +85,7 @@ class StartMigration implements ShouldQueue $this->company->save(); $zip = new ZipArchive(); - $archive = $zip->open($this->filepath); - + $archive = $zip->open(storage_path("app/{$this->filepath}")); $filename = pathinfo($this->filepath, PATHINFO_FILENAME); try { @@ -94,14 +93,14 @@ class StartMigration implements ShouldQueue throw new ProcessingMigrationArchiveFailed('Processing migration archive failed. Migration file is possibly corrupted.'); } - $zip->extractTo(storage_path("migrations/{$filename}")); + $zip->extractTo(storage_path("app/migrations/{$filename}")); $zip->close(); if (app()->environment() == 'testing') { return true; } - $file = storage_path("migrations/$filename/migration.json"); + $file = storage_path("app/migrations/$filename/migration.json"); if (! file_exists($file)) { throw new NonExistingMigrationFile('Migration file does not exist, or it is corrupted.'); From 503a0cbab6e991a296539680fe6e74499d9d01ad Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 30 Nov 2020 08:32:18 +1100 Subject: [PATCH 4/4] Version bump --- VERSION.txt | 2 +- config/ninja.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index c59541f10..802fbebe9 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.0.30 \ No newline at end of file +5.0.31 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 605279060..53e913473 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -12,7 +12,7 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/').'/', 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.0.30', + 'app_version' => '5.0.31', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),