-
Notifications
You must be signed in to change notification settings - Fork 611
/
BackupController.php
64 lines (57 loc) · 1.49 KB
/
BackupController.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
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
namespace craft\console\controllers;
use craft\console\Controller;
use craft\helpers\Console;
/**
* DEPRECATED. Use `db/backup` instead.
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 3.1.21
* @deprecated in 3.6.0. Use the `db/backup` command instead.
*/
class BackupController extends Controller
{
/**
* @inheritdoc
*/
public $defaultAction = 'db';
/**
* @var bool Whether the backup should be saved as a zip file.
* @since 3.5.0
*/
public bool $zip = false;
/**
* @var bool Whether to overwrite an existing backup file, if a specific file path is given.
* @since 3.5.0
*/
public bool $overwrite = false;
/**
* @inheritdoc
*/
public function options($actionID): array
{
$options = parent::options($actionID);
$options[] = 'zip';
$options[] = 'overwrite';
return $options;
}
/**
* DEPRECATED. Use `db/backup` instead.
*
* @param string|null $path
* @return int
*/
public function actionDb(?string $path = null): int
{
Console::outputWarning("The backup command is deprecated.\nRunning db/backup instead...");
return $this->run('db/backup', func_get_args() + [
'zip' => $this->zip,
'overwrite' => $this->overwrite,
]);
}
}