From 95af436f123f37778f5f3b97448bb39d57999fbe Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 10:33:26 +1100 Subject: [PATCH 1/2] Replace config:clear with optimize --- app/Console/Commands/PostUpdate.php | 5 +- app/Http/Controllers/SelfUpdateController.php | 2 +- app/Http/Controllers/SetupController.php | 65 ++++++++----------- app/Jobs/Util/SchedulerCheck.php | 2 +- 4 files changed, 30 insertions(+), 44 deletions(-) diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index 3f0a915039..e2d27b23b8 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -61,10 +61,7 @@ class PostUpdate extends Command try { - if(Ninja::isHosted()) - Artisan::call('optimize'); - else - Artisan::call('config:clear'); + Artisan::call('optimize'); } catch (\Exception $e) { info("I wasn't able to optimize."); diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index 8ae1c26255..62a5e5f9c5 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -81,7 +81,7 @@ class SelfUpdateController extends BaseController Artisan::call('clear-compiled'); Artisan::call('route:clear'); Artisan::call('view:clear'); - Artisan::call('config:clear'); + Artisan::call('optimize'); return response()->json(['message' => 'Update completed'], 200); diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 8325f4ff7d..07d0ea1ed2 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -74,34 +74,6 @@ 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); - - // 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); - - // 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'); @@ -164,15 +136,8 @@ class SetupController extends Controller define('STDIN', fopen('php://stdin', 'r')); /* 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('config:clear'); - // Artisan::call('optimize'); - } - + DB::purge('mysql'); + Artisan::call('optimize'); Artisan::call('migrate', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]); @@ -295,6 +260,30 @@ class SetupController extends Controller } } + public function clearCompiledCache() + { + + $cacheCompiled = base_path('bootstrap/cache/compiled.php'); + if (file_exists($cacheCompiled)) { + unlink ($cacheCompiled); + } + + $cacheServices = base_path('bootstrap/cache/packages.php'); + if (file_exists($cacheServices)) { + unlink ($cacheServices); + } + + $cacheServices = base_path('bootstrap/cache/services.php'); + if (file_exists($cacheServices)) { + unlink ($cacheServices); + } + + $cacheRoute = base_path('bootstrap/cache/routes-v7.php'); + if (file_exists($cacheRoute)) { + unlink ($cacheRoute); + } + } + public function update() { @@ -319,7 +308,7 @@ class SetupController extends Controller Artisan::call('clear-compiled'); Artisan::call('route:clear'); Artisan::call('view:clear'); - Artisan::call('config:clear'); + Artisan::call('optimize'); Artisan::call('migrate', ['--force' => true]); Artisan::call('db:seed', ['--force' => true]); diff --git a/app/Jobs/Util/SchedulerCheck.php b/app/Jobs/Util/SchedulerCheck.php index 409478ca01..697753850e 100644 --- a/app/Jobs/Util/SchedulerCheck.php +++ b/app/Jobs/Util/SchedulerCheck.php @@ -52,7 +52,7 @@ class SchedulerCheck implements ShouldQueue try { Artisan::call('clear-compiled'); Artisan::call('route:clear'); - Artisan::call('config:cache'); + Artisan::call('optimize'); } catch (\Exception $e) { nlog("I wasn't able to optimize."); nlog($e->getMessage()); From 683f836a460dcddc1293361f9dbd46d86e399e7f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 18 Mar 2022 10:35:37 +1100 Subject: [PATCH 2/2] v5.3.72 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 4e06b9704c..f13be7fcea 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.71 \ No newline at end of file +5.3.72 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 8d242e42b8..5c4c4a0d10 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.71', - 'app_tag' => '5.3.71', + 'app_version' => '5.3.72', + 'app_tag' => '5.3.72', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),