backup to backup folder

This commit is contained in:
Gert
2015-04-27 21:45:42 +02:00
parent c481acbb71
commit 5ccefee288
5 changed files with 15 additions and 2 deletions

2
.gitignore vendored
View File

@@ -7,6 +7,8 @@ vendor/
.sass-cache
# Grav Specific
backup/*
!backup/.*
cache/*
!cache/.*
assets/*

0
backup/.gitkeep Normal file
View File

View File

@@ -16,6 +16,7 @@ class ZipBackup
protected static $ignore = [
'.git',
'backup',
'cache',
'images',
'logs'
@@ -24,8 +25,11 @@ class ZipBackup
public static function backup($destination = null, callable $messager = null)
{
if (!$destination) {
$destination = self::getGrav()['locator']->findResource('cache://', true);
$destination = $destination . DS . 'tmp/Grav-' . uniqid();
$destination = self::getGrav()['locator']->findResource('backup://', true);
if (!$destination)
throw new \RuntimeException('The backup folder is missing.');
Folder::mkdir($destination);
}

View File

@@ -72,6 +72,12 @@ class Config extends Data
'prefixes' => [
'' => ['logs']
]
],
'backup' => [
'type' => 'Stream',
'prefixes' => [
'' => ['backup']
]
]
];

View File

@@ -20,6 +20,7 @@ class SandboxCommand extends Command
* @var array
*/
protected $directories = array(
'/backup',
'/cache',
'/logs',
'/images',