Files
nexusphp/app/Console/Kernel.php

71 lines
2.4 KiB
PHP
Raw Normal View History

2021-04-02 19:48:41 +08:00
<?php
namespace App\Console;
2024-03-23 04:51:59 +08:00
use App\Jobs\CheckCleanup;
2024-07-04 03:21:53 +08:00
use App\Jobs\CheckQueueFailedJobs;
2022-05-06 15:50:26 +08:00
use Carbon\Carbon;
2024-07-04 03:21:53 +08:00
use Illuminate\Console\Scheduling\Event;
2021-04-02 19:48:41 +08: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.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
2022-05-06 15:50:26 +08:00
$schedule->command('exam:assign_cronjob')->everyMinute()->withoutOverlapping();
2022-11-09 21:56:03 +08:00
$schedule->command('exam:checkout_cronjob')->everyFiveMinutes()->withoutOverlapping();
2022-05-06 15:50:26 +08:00
$schedule->command('exam:update_progress --bulk=1')->hourly()->withoutOverlapping();
$schedule->command('backup:cronjob')->everyMinute()->withoutOverlapping();
2022-10-27 20:21:54 +08:00
$schedule->command('hr:update_status')->everyTenMinutes()->withoutOverlapping();
2022-05-06 15:50:26 +08:00
$schedule->command('hr:update_status --ignore_time=1')->hourly()->withoutOverlapping();
2023-08-04 13:22:27 +08:00
$schedule->command('user:delete_expired_token')->dailyAt('04:00')->withoutOverlapping();
2022-06-01 13:15:55 +08:00
$schedule->command('claim:settle')->hourly()->when(function () {
return Carbon::now()->format('d') == '01';
})->withoutOverlapping();
$schedule->command('meilisearch:import')->weeklyOn(1, "03:00")->withoutOverlapping();
2023-08-04 13:22:27 +08:00
$schedule->command('torrent:load_pieces_hash')->dailyAt("01:00")->withoutOverlapping();
2024-07-04 03:21:53 +08:00
$schedule->job(new CheckQueueFailedJobs())->everySixHours()->withoutOverlapping();
2024-03-23 04:51:59 +08:00
$this->registerScheduleCleanup($schedule);
2021-04-02 19:48:41 +08:00
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
2024-03-23 04:51:59 +08:00
private function registerScheduleCleanup(Schedule $schedule): void
{
$interval = get_setting("main.autoclean_interval_one");
if (!$interval || $interval < 60) {
$interval = 7200;
}
$schedule->job(new CheckCleanup())
2024-03-23 05:19:15 +08:00
->cron(sprintf("*/%d * * * *", ceil($interval/60)))
2024-03-23 04:51:59 +08:00
->withoutOverlapping();
}
2021-04-02 19:48:41 +08:00
}