diff options
| author | horus | 2022-11-17 19:57:52 +0100 |
|---|---|---|
| committer | horus | 2022-11-17 19:57:52 +0100 |
| commit | f4d0db3c67127919f431459aa1e430cab4e6d380 (patch) | |
| tree | 8d3cb288ccac34e108350543352fafc953d7ebe4 /app/Console/Kernel.php | |
| parent | f2e76ff110f531703f2c4f400e1fa285ee05ad94 (diff) | |
| download | senpai-f4d0db3c67127919f431459aa1e430cab4e6d380.tar.gz | |
Change scheduler from closures to artisan commands
Diffstat (limited to 'app/Console/Kernel.php')
| -rw-r--r-- | app/Console/Kernel.php | 118 |
1 files changed, 17 insertions, 101 deletions
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index fc949d4..907ee4a 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -5,12 +5,6 @@ namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; -use App\Libraries\AnimeSeason; -use App\Libraries\Helper; -use App\Libraries\Background; - -use App\Anime; - class Kernel extends ConsoleKernel { /** @@ -30,107 +24,29 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule) { - // $schedule->command('inspire') - // ->hourly(); - - $schedule->call( function(){ - $background = new Background(); - $background->saveAnimeStats(); - })->everyThirtyMinutes()->name('saveStats2')->withoutOverlapping(); - #})->everyThirtyMinutes()->name('saveStats5')->withoutOverlapping(); - #})->everyMinute()->name('saveStats3')->withoutOverlapping(); - #})->everyMinute()->name('saveStats5'); - - $schedule->call( function(){ - $background = new Background(); - echo "SaveSeason(): \n"; - $background->saveSeason(); - sleep(10); - echo "\ncheckIfIsAiring(): \n"; - $background->checkIfIsAiring(); - sleep(10); - echo "\nsaveAiringForAll(): \n"; - $background->saveAiringForAll(); - })->dailyAt('18:30'); - #})->everyMinute(); - $schedule->call( function(){ - $helper = new Helper(); - #$helper->createUser( 'll-' ); - echo "setIsWatchingForAll(): \n"; - $helper->setIsWatchingForAll(); - echo "\nsetCalendarForAll(): \n"; - $helper->setCalendarForAll(); - })->twiceDaily(7, 19); - #})->everyMinute(); + $schedule->command("anime:saveStats") + ->everyThirtyMinutes()->name('saveStats') + ->emailOutputTo( env('STATUS_MAIL_ADDRESS') ) + #->everyMinute()->name('saveStats1'); + ->withoutOverlapping(); - $schedule->call( function(){ - $background = new Background(); - echo "saveTopAnime()\n"; - $background->saveTopAnime(); - echo "saveTopAnimeByPopularity()\n"; - $background->saveTopAnimeByPopularity(); - echo"saveEnhancementForAll()\n"; - $background->saveEnhancementForAll(); - echo "addSeasonToAllAnime()\n"; - $background->addSeasonToAllAnime(); - })->weeklyOn(1, '15:30')->name('saveTopAnime')->withoutOverlapping(); - #})->everyMinute(); + $schedule->command("anime:saveSeasonAiring") + ->dailyAt('18:30') + ->emailOutputTo( env('STATUS_MAIL_ADDRESS') ); - $schedule->call( function(){ - $background = new Background(); - echo "checkImage()\n"; - $background->checkImage(); - })->weeklyOn(3, '18:00')->name('checkForBrokenThings')->withoutOverlapping(); - #})->everyMinute(); + $schedule->command("anime:setWatchingCalender") + ->twiceDaily(7, 19) + ->emailOutputTo( env('STATUS_MAIL_ADDRESS') ); - /* - $schedule->call( function(){ - $background = new Background(); - #$background->checkIfIsAiring(); - #$background->saveSeason(); - $background->saveEnhancementForAll(); - #$background->addSeasonToAllAnime(); - #$anime = Anime::where('mal_id', 40591)->get()->first(); - #$background->saveAiring( $anime ); - })->everyMinute()->name("enhance3")->withoutOverlapping(); - #})->everyMinute()->name("enhance6"); - #})->twiceDaily(9, 23); - */ + $schedule->command("anime:saveTopAnimeEnhance") + ->weeklyOn(1, '15:30')->name('saveTopAnime') + ->emailOutputTo( env('STATUS_MAIL_ADDRESS') ); - /* - $schedule->call( function(){ - $background = new Background(); - echo "\ncheckIfIsAiring(): \n"; - $background->checkIfIsAiring(); - sleep(10); - echo "\nsaveAiringForAll(): \n"; - $background->saveAiringForAll(); - #$background->checkIfIsAiring(); - #$background->checkImage(); - #$background->saveTopAnimeByPopularity(); - #$anime = Anime::where('mal_id', 40591)->get()->first(); - #$background->saveAiring( $anime ); - #echo"saveEnhancementForAll()\n"; - #$background->saveEnhancementForAll(); - })->everyMinute()->name('c4')->withoutOverlapping(); - #})->dailyAt('3:00')->name('saveTopAnimeByPopularity')->withoutOverlapping(); - #})->everyMinute()->name('saveTopAnimeByPopularity2')->withoutOverlapping(); - */ - /* - $schedule->call( function(){ - $background = new Background(); - echo "saveAiringForAll(): \n"; - $background->saveAiringForAll(); + $schedule->command("anime:checkImage") + ->weeklyOn(3, '18:00')->name('checkForBrokenThings') + ->emailOutputTo( env('STATUS_MAIL_ADDRESS') ); - $helper = new Helper(); - #$helper->createUser( 'll-' ); - echo "setIsWatchingForAll(): \n"; - #$helper->setIsWatchingForAll(); - echo "\nsetCalendarForAll(): \n"; - $helper->setCalendarForAll(); - })->everyMinute()->name('c8')->withoutOverlapping(); - */ } /** |
