-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.php
More file actions
53 lines (43 loc) · 1.93 KB
/
Copy pathPlugin.php
File metadata and controls
53 lines (43 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace App\Vito\Plugins\Newplayer\BackupDownloader;
use App\Plugins\AbstractPlugin;
use App\Plugins\RegisterCommand;
use App\Plugins\RegisterServerFeature;
use App\Plugins\RegisterServerFeatureAction;
use App\Vito\Plugins\Newplayer\BackupDownloader\Actions\Disable;
use App\Vito\Plugins\Newplayer\BackupDownloader\Actions\Download;
use App\Vito\Plugins\Newplayer\BackupDownloader\Actions\Enable;
use App\Vito\Plugins\Newplayer\BackupDownloader\Commands\DownloadBackups;
use App\Vito\Plugins\Newplayer\BackupDownloader\Commands\DownloadBackupsFromServer;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Facades\Event;
class Plugin extends AbstractPlugin
{
protected string $name = 'Backup Downloader';
protected string $description = 'Download the local backups from the server, and save it on Vito\'s';
public function boot(): void
{
RegisterServerFeature::make('backup_downloader')
->label('Download Backups from Server')
->description('Enable periodic backups download from this server')
->register();
RegisterServerFeatureAction::make('backup_downloader', 'enable')
->label('Enable')
->handler(Enable::class)
->register();
RegisterServerFeatureAction::make('backup_downloader', 'disable')
->label('Disable')
->handler(Disable::class)
->register();
RegisterServerFeatureAction::make('backup_downloader', 'download')
->label('Download backups')
->handler(Download::class)
->register();
RegisterCommand::make(DownloadBackups::class)->register();
RegisterCommand::make(DownloadBackupsFromServer::class)->register();
Event::listen('console.scheduling', function ($schedule) {
/** @var Schedule $schedule */
$schedule->command(DownloadBackups::class)->hourly()->withoutOverlapping();
});
}
}