mirror of
https://github.com/getgrav/grav.git
synced 2026-07-06 23:28:14 +02:00
backup to backup folder
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,6 +7,8 @@ vendor/
|
||||
.sass-cache
|
||||
|
||||
# Grav Specific
|
||||
backup/*
|
||||
!backup/.*
|
||||
cache/*
|
||||
!cache/.*
|
||||
assets/*
|
||||
|
||||
0
backup/.gitkeep
Normal file
0
backup/.gitkeep
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,12 @@ class Config extends Data
|
||||
'prefixes' => [
|
||||
'' => ['logs']
|
||||
]
|
||||
],
|
||||
'backup' => [
|
||||
'type' => 'Stream',
|
||||
'prefixes' => [
|
||||
'' => ['backup']
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ class SandboxCommand extends Command
|
||||
* @var array
|
||||
*/
|
||||
protected $directories = array(
|
||||
'/backup',
|
||||
'/cache',
|
||||
'/logs',
|
||||
'/images',
|
||||
|
||||
Reference in New Issue
Block a user