| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | use Illuminate\Support\ServiceProvider; |
||
| 9 | |||
| 10 | class RotateServiceProvider extends ServiceProvider |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Bootstrap the application services. |
||
| 14 | * |
||
| 15 | * @return void |
||
| 16 | */ |
||
| 17 | public function boot() |
||
| 18 | { |
||
| 19 | $this->publishes([ |
||
| 20 | __DIR__.'/../config/rotate.php' => config_path('rotate.php'), |
||
| 21 | ], 'config'); |
||
| 22 | |||
| 23 | if ($this->app->runningInConsole()) { |
||
| 24 | $this->commands([ |
||
| 25 | RotateCommand::class, |
||
| 26 | RotateFileCommand::class, |
||
| 27 | ]); |
||
| 28 | |||
| 29 | $this->registerSchedule(); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Register the application services. |
||
| 35 | * |
||
| 36 | * @return void |
||
| 37 | */ |
||
| 38 | public function register() |
||
| 41 | } |
||
| 42 | |||
| 43 | private function registerSchedule() |
||
| 44 | { |
||
| 45 | if (!config('rotate.schedule.enable', true)) { |
||
| 46 | return; |
||
| 47 | } |
||
| 48 | |||
| 49 | $this->callAfterResolving(Schedule::class, function (Schedule $schedule) { |
||
| 50 | $cronOldVersion = config('rotate.logs_rotate_schedule', '0 0 * * *'); |
||
| 51 | $cron = config('rotate.schedule.cron', $cronOldVersion); |
||
| 52 | |||
| 57 |