2018-10-04 19:10:43 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2019-05-11 05:32:07 +02:00
|
|
|
*/
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
namespace App\Console;
|
|
|
|
|
2021-05-26 11:51:04 +02:00
|
|
|
use App\Jobs\Cron\AutoBillCron;
|
2021-08-24 13:59:21 +02:00
|
|
|
use App\Jobs\Cron\RecurringExpensesCron;
|
2020-03-07 23:15:11 +01:00
|
|
|
use App\Jobs\Cron\RecurringInvoicesCron;
|
2021-05-26 11:51:04 +02:00
|
|
|
use App\Jobs\Cron\SubscriptionCron;
|
2020-05-04 23:54:24 +02:00
|
|
|
use App\Jobs\Ninja\AdjustEmailQuota;
|
2020-07-05 10:59:28 +02:00
|
|
|
use App\Jobs\Ninja\CompanySizeCheck;
|
2021-06-07 00:41:04 +02:00
|
|
|
use App\Jobs\Util\DiskCleanup;
|
2020-04-15 02:30:52 +02:00
|
|
|
use App\Jobs\Util\ReminderJob;
|
2021-01-23 05:52:54 +01:00
|
|
|
use App\Jobs\Util\SchedulerCheck;
|
2020-04-30 13:45:47 +02:00
|
|
|
use App\Jobs\Util\SendFailedEmails;
|
2020-05-12 11:56:30 +02:00
|
|
|
use App\Jobs\Util\UpdateExchangeRates;
|
2020-03-07 23:15:11 +01:00
|
|
|
use App\Jobs\Util\VersionCheck;
|
2020-03-25 14:03:23 +01:00
|
|
|
use App\Utils\Ninja;
|
2018-10-04 19:10:43 +02:00
|
|
|
use Illuminate\Console\Scheduling\Schedule;
|
|
|
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
|
|
|
|
|
|
|
class Kernel extends ConsoleKernel
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The Artisan commands provided by your application.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $commands = [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the application's command schedule.
|
|
|
|
*
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param Schedule $schedule
|
2018-10-04 19:10:43 +02:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function schedule(Schedule $schedule)
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2021-03-23 13:17:28 +01:00
|
|
|
$schedule->job(new VersionCheck)->daily();
|
2020-03-23 18:15:56 +01:00
|
|
|
|
2021-06-07 00:41:04 +02:00
|
|
|
$schedule->job(new DiskCleanup)->daily()->withoutOverlapping();
|
|
|
|
|
2021-05-26 04:37:16 +02:00
|
|
|
$schedule->command('ninja:check-data --database=db-ninja-01')->daily()->withoutOverlapping();
|
2020-07-21 08:02:15 +02:00
|
|
|
|
2021-06-11 00:20:46 +02:00
|
|
|
$schedule->job(new ReminderJob)->hourly()->withoutOverlapping();
|
2020-05-12 11:56:30 +02:00
|
|
|
|
2020-09-16 12:08:51 +02:00
|
|
|
$schedule->job(new CompanySizeCheck)->daily()->withoutOverlapping();
|
2020-07-05 10:59:28 +02:00
|
|
|
|
2020-09-16 12:08:51 +02:00
|
|
|
$schedule->job(new UpdateExchangeRates)->daily()->withoutOverlapping();
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2021-03-25 11:55:59 +01:00
|
|
|
$schedule->job(new SubscriptionCron)->daily()->withoutOverlapping();
|
2021-03-05 11:18:28 +01:00
|
|
|
|
2020-09-16 12:08:51 +02:00
|
|
|
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
|
2021-08-24 13:59:21 +02:00
|
|
|
|
|
|
|
$schedule->job(new RecurringExpensesCron)->dailyAt('23:45')->withoutOverlapping();
|
|
|
|
|
2021-05-26 12:01:06 +02:00
|
|
|
$schedule->job(new AutoBillCron)->dailyAt('00:30')->withoutOverlapping();
|
2021-05-26 11:51:04 +02:00
|
|
|
|
2021-07-05 13:58:22 +02:00
|
|
|
$schedule->job(new SchedulerCheck)->daily()->withoutOverlapping();
|
2020-09-08 12:34:14 +02:00
|
|
|
|
2020-04-30 13:45:47 +02:00
|
|
|
/* Run hosted specific jobs */
|
2020-09-06 11:38:10 +02:00
|
|
|
if (Ninja::isHosted()) {
|
2021-01-23 05:52:54 +01:00
|
|
|
|
2021-08-07 12:56:42 +02:00
|
|
|
$schedule->job(new AdjustEmailQuota)->dailyAt('23:00')->withoutOverlapping();
|
2021-03-19 13:37:57 +01:00
|
|
|
$schedule->job(new SendFailedEmails)->daily()->withoutOverlapping();
|
2021-05-26 04:37:16 +02:00
|
|
|
$schedule->command('ninja:check-data --database=db-ninja-02')->daily()->withoutOverlapping();
|
2021-01-23 05:52:54 +01:00
|
|
|
|
2020-04-30 13:45:47 +02:00
|
|
|
}
|
2021-03-19 13:37:57 +01:00
|
|
|
|
2021-06-09 02:27:01 +02:00
|
|
|
if(config('queue.default') == 'database' && Ninja::isSelfHost() && config('ninja.internal_queue_enabled') && !config('ninja.is_docker')) {
|
2021-05-10 13:05:44 +02:00
|
|
|
|
2021-04-17 23:06:12 +02:00
|
|
|
$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
|
|
|
|
$schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping();
|
2021-05-10 13:05:44 +02:00
|
|
|
|
2021-04-17 23:06:12 +02:00
|
|
|
}
|
|
|
|
|
2018-10-04 19:10:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the commands for the application.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function commands()
|
|
|
|
{
|
|
|
|
$this->load(__DIR__.'/Commands');
|
|
|
|
|
|
|
|
require base_path('routes/console.php');
|
|
|
|
}
|
|
|
|
}
|