mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Minor backups fixes
This commit is contained in:
parent
720274446e
commit
b9b8149234
|
@ -38,28 +38,7 @@ class SystemBackup extends Command {
|
||||||
public function fire()
|
public function fire()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
$files['avatars'] = glob(public_path().'/uploads/avatars/*');
|
$this->call('backup:run');
|
||||||
$files['models'] = glob(public_path().'/uploads/models/*');
|
|
||||||
$files['suppliers'] = glob(public_path().'/uploads/suppliers/*');
|
|
||||||
$files['private_uploads'] = glob(config('app.private_uploads').'/*');
|
|
||||||
$base_filename = date('Ymdgis');
|
|
||||||
$zip_file = config('app.private_uploads').'/backups/zips/'.$base_filename.'-backup.zip';
|
|
||||||
$db_dump = config('app.private_uploads').'/backups/sql/'.$base_filename.'-db.sql';
|
|
||||||
$this->call('db:backup', array('filename' => $db_dump));
|
|
||||||
echo $zip_file."\n";
|
|
||||||
echo $db_dump."\n";
|
|
||||||
|
|
||||||
|
|
||||||
Zipper::make($zip_file)
|
|
||||||
->folder('avatars')->add($files['avatars'])
|
|
||||||
->folder('models')->add($files['models'])
|
|
||||||
->folder('suppliers')->add($files['suppliers'])
|
|
||||||
->folder('private_uploads')->add($files['private_uploads'])
|
|
||||||
->folder('database')->add($db_dump)->close();
|
|
||||||
|
|
||||||
$this->info('Backup file created at '.$zip_file);
|
|
||||||
$this->info('Removing SQL dump at '.$db_dump);
|
|
||||||
unlink($db_dump);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ class SettingsController extends Controller
|
||||||
public function getBackups()
|
public function getBackups()
|
||||||
{
|
{
|
||||||
|
|
||||||
$path = config('app.private_uploads').'/backups';
|
$path = storage_path().'/app/'.config('laravel-backup.destination.path');
|
||||||
|
|
||||||
$files = array();
|
$files = array();
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ class SettingsController extends Controller
|
||||||
public function downloadFile($filename = null)
|
public function downloadFile($filename = null)
|
||||||
{
|
{
|
||||||
if (!config('app.lock_passwords')) {
|
if (!config('app.lock_passwords')) {
|
||||||
$path = config('app.private_uploads').'/backups';
|
$path = storage_path().'/app/'.config('laravel-backup.destination.path');
|
||||||
$file = $path.'/'.$filename;
|
$file = $path.'/'.$filename;
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
return Response::download($file);
|
return Response::download($file);
|
||||||
|
@ -504,7 +504,8 @@ class SettingsController extends Controller
|
||||||
|
|
||||||
if (!config('app.lock_passwords')) {
|
if (!config('app.lock_passwords')) {
|
||||||
|
|
||||||
$file = config('backup::path').'/'.$filename;
|
$path = storage_path().'/app/'.config('laravel-backup.destination.path');
|
||||||
|
$file = $path.'/'.$filename;
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
return redirect()->route('settings/backups')->with('success', trans('admin/settings/message.backup.file_deleted'));
|
return redirect()->route('settings/backups')->with('success', trans('admin/settings/message.backup.file_deleted'));
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"doctrine/common": "v2.5.3",
|
"doctrine/common": "v2.5.3",
|
||||||
"doctrine/dbal": "v2.4.2",
|
"doctrine/dbal": "v2.4.2",
|
||||||
"barryvdh/laravel-debugbar": "^2.1",
|
"barryvdh/laravel-debugbar": "^2.1",
|
||||||
"spatie/laravel-backup": "^2.9"
|
"spatie/laravel-backup": "3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
|
|
457
composer.lock
generated
457
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<p>Backup files are located in: app/storage/dumps</p>
|
<p>Backup files are located in: {{ $path }}</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue