1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Place additional checks in the scheduler to ensure the config is optimized appropriately

This commit is contained in:
= 2021-01-23 16:09:58 +11:00
parent ad40434686
commit e39759c35b

View File

@ -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();
}
}
}