-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.php
More file actions
52 lines (35 loc) · 1000 Bytes
/
Copy pathbackup.php
File metadata and controls
52 lines (35 loc) · 1000 Bytes
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
<?php
declare(strict_types=1);
namespace CMS\PhpBackup;
if (!isset($_GET['key']) || 'pZk5ukBLtZ6wdQgZ' !== $_GET['key']) {
$msg = 'Forbidden';
header('HTTP/1.1 403 ' . $msg, true, 403);
exit($msg);
}
if (!isset($_GET['app']) || empty($_GET['app'])) {
$msg = 'Forbidden';
header('HTTP/1.1 403 ' . $msg, true, 403);
exit($msg);
}
require_once __DIR__ . DIRECTORY_SEPARATOR . 'defines.php';
if (!defined('ABS_PATH')) {
$msg = 'ABS_PATH not defined';
header('HTTP/1.1 500 ' . $msg, true, 500);
exit($msg);
}
use CMS\PhpBackup\App\BackupRunner;
use CMS\PhpBackup\Core\AppConfig;
$apps = explode(',', $_GET['app']);
foreach ($apps as $appName) {
$cfg = AppConfig::loadAppConfig($appName);
if (!$cfg) {
$msg = "Wrong App: {$appName}";
header('HTTP/1.1 404 ' . $msg, true, 404);
exit($msg);
}
$runner = new BackupRunner();
if ($runner->run()) {
break;
}
}
echo '<h2>Step Execution completed.</h2>';