From 5aaa2430b4f6dc22666d7def23d3a5f14be94eba Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 28 Aug 2020 14:10:43 -0700 Subject: [PATCH] Fixes for backups --- app/Http/Controllers/SettingsController.php | 23 ++++++++++++++------- config/backup.php | 9 ++++---- config/filesystems.php | 5 +++++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 422e9a83c9..9082f7223a 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -1008,19 +1008,28 @@ class SettingsController extends Controller */ public function getBackups() { - $path = storage_path() . '/app/' . config('backup.backup.name'); - $path = 'backups'; + $path = 'app/backups'; $backup_files = Storage::files($path); $files = []; if (count($backup_files) > 0) { for ($f = 0; $f < count($backup_files); ++$f) { - $files[] = [ - 'filename' => basename($backup_files[$f]), - 'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])), - 'modified' => Storage::lastModified($backup_files[$f]), - ]; + + // Skip dotfiles like .gitignore and .DS_STORE + if ((substr(basename($backup_files[$f]), 0, 1) != '.')) { + \Log::debug(basename($backup_files[$f])); + \Log::debug($backup_files[$f]. ' is dotfileish?'); + + $files[] = [ + 'filename' => basename($backup_files[$f]), + 'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])), + 'modified' => Storage::lastModified($backup_files[$f]), + ]; + + } + + } } diff --git a/config/backup.php b/config/backup.php index f4d0f3b975..dd5714957f 100644 --- a/config/backup.php +++ b/config/backup.php @@ -12,7 +12,6 @@ // This is janky, but necessary to figure out whether to include the .env in the backup $included_dirs = [ base_path('public/uploads'), - base_path('config'), base_path('storage/private_uploads'), base_path('storage/oauth-private.key'), base_path('storage/oauth-public.key'), @@ -78,7 +77,7 @@ return [ * For a complete list of available customization options, see https://github.com/spatie/db-dumper */ 'databases' => [ - 'mysql', + env('DB_CONNECTION', 'mysql'), ], ], @@ -106,7 +105,7 @@ return [ * The disk names on which the backups will be stored. */ 'disks' => [ - 'local', + 'backup', ], ], @@ -167,7 +166,7 @@ return [ 'monitorBackups' => [ [ 'name' => config('app.name'), - 'disks' => ['local'], + 'disks' => [env('PRIVATE_FILESYSTEM_DISK', 'local')], 'newestBackupsShouldNotBeOlderThanDays' => 1, 'storageUsedMayNotBeHigherThanMegabytes' => 5000, ], @@ -214,7 +213,7 @@ return [ /* * The number of months for which one monthly backup must be kept. */ - 'keepMonthlyBackupsForMonths' => 4, + 'keepMonthlyBackupsForMonths' => 3, /* * The number of years for which one yearly backup must be kept. diff --git a/config/filesystems.php b/config/filesystems.php index 1294721bbf..b4bf6303e4 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -92,6 +92,11 @@ $config = [ 'url_type' => env('RACKSPACE_URL_TYPE'), ], + 'backup' => [ + 'driver' => env('PRIVATE_FILESYSTEM_DISK', 'local'), + 'root' => storage_path('app'), + ], + ], ];