-
Notifications
You must be signed in to change notification settings - Fork 3
/
Plugin.php
105 lines (97 loc) · 3.08 KB
/
Plugin.php
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php namespace Webula\SmallBackup;
include_once(__DIR__ . '/helpers/helpers.php'); // for version without Composer
use System\Classes\PluginBase;
use Artisan;
/**
* SmallBackup Plugin Information File
*/
class Plugin extends PluginBase
{
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'webula.smallbackup::lang.plugin.name',
'description' => 'webula.smallbackup::lang.plugin.description',
'author' => 'Webula',
'icon' => 'icon-database'
];
}
/**
* Register method, called when the plugin is first registered.
*
* @return void
*/
public function register()
{
$this->registerConsoleCommand('smallbackup.db', Console\BackupDb::class);
$this->registerConsoleCommand('smallbackup.theme', Console\BackupTheme::class);
$this->registerConsoleCommand('smallbackup.storage', Console\BackupStorage::class);
}
/**
* Registers schedule calls implemented in this plugin.
*
* @return void
*/
public function registerSchedule($schedule)
{
if (Models\Settings::get('db_auto')) {
// $schedule->command('smallbackup:db')->daily();
// Workaround because of shared hostings disables proc_open
$schedule->call(function () {
Artisan::call('smallbackup:db');
})->daily();
}
if (Models\Settings::get('theme_auto')) {
// $schedule->command('smallbackup:theme')->daily();
$schedule->call(function () {
Artisan::call('smallbackup:theme');
})->daily();
}
if (Models\Settings::get('storage_auto')) {
// $schedule->command('smallbackup:storage')->daily();
$schedule->call(function () {
Artisan::call('smallbackup:storage');
})->daily();
}
}
/**
* Register any back-end setting used by this plugin.
*
* @return array
*/
public function registerSettings()
{
return [
'settings' => [
'label' => 'webula.smallbackup::lang.plugin.name',
'description' => 'webula.smallbackup::lang.plugin.description',
'category' => 'Small plugins',
'icon' => 'icon-database',
'class' => Models\Settings::class,
'url' => \Backend::url('webula/smallbackup/settings/update'),
'keywords' => 'database backup',
'order' => 991,
'permissions' => ['webula.smallbackup.access_settings'],
]
];
}
/**
* Registers any back-end permissions used by this plugin.
*
* @return array
*/
public function registerPermissions()
{
return [
'webula.smallbackup.access_settings' => [
'label' => 'webula.smallbackup::lang.permissions.access_settings',
'tab' => 'webula.smallbackup::lang.plugin.name',
],
];
}
}