Kernel.php 1.39 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
3
4
<?php

namespace App\Console;

5
use DB;
Dominik Hebeler's avatar
Dominik Hebeler committed
6
7
8
9
10
11
12
13
14
15
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
     */
16
    protected $commands = [];
Dominik Hebeler's avatar
Dominik Hebeler committed
17
18
19
20
21
22
23
24
25

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
Dominik Hebeler's avatar
Dominik Hebeler committed
26
        $schedule->command('heartbeat')->everyMinute();
27
        $schedule->command('requests:gather')->everyFifteenMinutes();
28
        $schedule->command('requests:useragents')->everyFiveMinutes();
Dominik Hebeler's avatar
Dominik Hebeler committed
29
        $schedule->command('logs:gather')->everyMinute();
Dominik Hebeler's avatar
Dominik Hebeler committed
30
        $schedule->command('spam:load')->everyMinute();
31
        $schedule->command('load:affiliate-blacklist')->everyMinute();
Dominik Hebeler's avatar
Dominik Hebeler committed
32
33
        $schedule->command('affilliates:store')->everyMinute()
            ->onOneServer();
34
35
        $schedule->call(function () {
            DB::table('monthlyrequests')->truncate();
Dominik Hebeler's avatar
Dominik Hebeler committed
36
            DB::disconnect('mysql');
37
        })->monthlyOn(1, '00:00');
38
39
40
41
42
43
44
45
46
47
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
48
        $this->load(__DIR__ . '/Commands');
Dominik Hebeler's avatar
Dominik Hebeler committed
49
50
    }
}