|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Spatie\Backup; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
|
6
|
|
|
use Spatie\Backup\Commands\BackupCommand; |
|
7
|
|
|
use Spatie\Backup\Commands\CleanupCommand; |
|
8
|
|
|
use Spatie\Backup\Commands\ListCommand; |
|
9
|
|
|
use Spatie\Backup\Commands\MonitorCommand; |
|
10
|
|
|
use Spatie\Backup\Helpers\ConsoleOutput; |
|
11
|
|
|
use Spatie\Backup\Notifications\EventHandler; |
|
12
|
|
|
use Spatie\Backup\Tasks\Cleanup\CleanupStrategy; |
|
13
|
|
|
|
|
14
|
|
|
class BackupServiceProvider extends ServiceProvider |
|
15
|
|
|
{ |
|
16
|
|
|
public function boot() |
|
17
|
|
|
{ |
|
18
|
|
|
$this->publishes([ |
|
19
|
|
|
__DIR__.'/../config/backup.php' => config_path('backup.php'), |
|
20
|
|
|
], 'config'); |
|
21
|
|
|
|
|
22
|
|
|
$this->publishes([ |
|
23
|
|
|
__DIR__.'/../resources/lang' => "{$this->app['path.lang']}/vendor/backup", |
|
24
|
|
|
]); |
|
25
|
|
|
|
|
26
|
|
|
$this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'backup'); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
public function register() |
|
30
|
|
|
{ |
|
31
|
|
|
$this->mergeConfigFrom(__DIR__.'/../config/backup.php', 'backup'); |
|
32
|
|
|
|
|
33
|
|
|
$this->app['events']->subscribe(EventHandler::class); |
|
34
|
|
|
|
|
35
|
|
|
$this->app->bind('command.backup:run', BackupCommand::class); |
|
36
|
|
|
$this->app->bind('command.backup:clean', CleanupCommand::class); |
|
37
|
|
|
$this->app->bind('command.backup:list', ListCommand::class); |
|
38
|
|
|
$this->app->bind('command.backup:monitor', MonitorCommand::class); |
|
39
|
|
|
|
|
40
|
|
|
$this->app->bind(CleanupStrategy::class, config('backup.cleanup.strategy')); |
|
41
|
|
|
|
|
42
|
|
|
$this->commands([ |
|
43
|
|
|
'command.backup:run', |
|
44
|
|
|
'command.backup:clean', |
|
45
|
|
|
'command.backup:list', |
|
46
|
|
|
'command.backup:monitor', |
|
47
|
|
|
]); |
|
48
|
|
|
|
|
49
|
|
|
$this->app->singleton(ConsoleOutput::class); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|