initial backup dropdown integration

This commit is contained in:
Andy Miller
2018-09-10 21:41:02 -06:00
parent 1c5848cd6c
commit 169b1e71e4
3 changed files with 32 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace Grav\Plugin\Admin;
use Grav\Common\Backup\Backups;
use Grav\Common\Cache;
use Grav\Common\Config\Config;
use Grav\Common\File\CompiledYamlFile;
@@ -1337,22 +1338,22 @@ class AdminController extends AdminBaseController
$download = $this->grav['uri']->param('download');
if ($download) {
$file = base64_decode(urldecode($download));
$backups_root_dir = $this->grav['locator']->findResource('backup://', true);
try {
if ($download) {
$file = base64_decode(urldecode($download));
$backups_root_dir = $this->grav['locator']->findResource('backup://', true);
if (0 !== strpos($file, $backups_root_dir)) {
header('HTTP/1.1 401 Unauthorized');
exit();
if (0 !== strpos($file, $backups_root_dir)) {
header('HTTP/1.1 401 Unauthorized');
exit();
}
Utils::download($file, true);
}
Utils::download($file, true);
}
$log = JsonFile::instance($this->grav['locator']->findResource("log://backup.log", true, true));
try {
$backup = ZipBackup::backup();
$log = JsonFile::instance($this->grav['locator']->findResource("log://backup.log", true, true));
$id = $this->grav['uri']->param('id', 0);
$backup = Backups::backup($id);
} catch (\Exception $e) {
$this->admin->json_response = [
'status' => 'error',