From e39759c35b9e109275939d3e6f7dff7b45e1d104 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 23 Jan 2021 16:09:58 +1100 Subject: [PATCH] Place additional checks in the scheduler to ensure the config is optimized appropriately --- app/Jobs/Util/SchedulerCheck.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/Jobs/Util/SchedulerCheck.php b/app/Jobs/Util/SchedulerCheck.php index 260d948f69e1..318e9d3b9369 100644 --- a/app/Jobs/Util/SchedulerCheck.php +++ b/app/Jobs/Util/SchedulerCheck.php @@ -17,6 +17,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Facades\Artisan; class SchedulerCheck implements ShouldQueue { @@ -33,6 +34,37 @@ class SchedulerCheck implements ShouldQueue */ public function handle() { + set_time_limit(0); + Account::whereNotNull('id')->update(['is_scheduler_running' => true]); + + if(config('ninja.app_version') != base_path('VERSION.txt')) + { + + try { + Artisan::call('migrate', ['--force' => true]); + } catch (\Exception $e) { + nlog("I wasn't able to migrate the data."); + } + + + try { + Artisan::call('optimize'); + } catch (\Exception $e) { + nlog("I wasn't able to optimize."); + } + + + try { + Artisan::call('view:clear'); + } catch (\Exception $e) { + nlog("I wasn't able to clear the views."); + } + + + VersionCheck::dispatch(); + + } + } }