Fixes for backups

This commit is contained in:
snipe 2020-08-28 14:10:43 -07:00
parent bc5a82e734
commit 5aaa2430b4
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC
3 changed files with 25 additions and 12 deletions

View file

@ -1008,19 +1008,28 @@ class SettingsController extends Controller
*/ */
public function getBackups() public function getBackups()
{ {
$path = storage_path() . '/app/' . config('backup.backup.name');
$path = 'backups'; $path = 'app/backups';
$backup_files = Storage::files($path); $backup_files = Storage::files($path);
$files = []; $files = [];
if (count($backup_files) > 0) { if (count($backup_files) > 0) {
for ($f = 0; $f < count($backup_files); ++$f) { for ($f = 0; $f < count($backup_files); ++$f) {
$files[] = [
'filename' => basename($backup_files[$f]), // Skip dotfiles like .gitignore and .DS_STORE
'filesize' => Setting::fileSizeConvert(Storage::size($backup_files[$f])), if ((substr(basename($backup_files[$f]), 0, 1) != '.')) {
'modified' => Storage::lastModified($backup_files[$f]), \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]),
];
}
} }
} }

View file

@ -12,7 +12,6 @@
// This is janky, but necessary to figure out whether to include the .env in the backup // This is janky, but necessary to figure out whether to include the .env in the backup
$included_dirs = [ $included_dirs = [
base_path('public/uploads'), base_path('public/uploads'),
base_path('config'),
base_path('storage/private_uploads'), base_path('storage/private_uploads'),
base_path('storage/oauth-private.key'), base_path('storage/oauth-private.key'),
base_path('storage/oauth-public.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 * For a complete list of available customization options, see https://github.com/spatie/db-dumper
*/ */
'databases' => [ 'databases' => [
'mysql', env('DB_CONNECTION', 'mysql'),
], ],
], ],
@ -106,7 +105,7 @@ return [
* The disk names on which the backups will be stored. * The disk names on which the backups will be stored.
*/ */
'disks' => [ 'disks' => [
'local', 'backup',
], ],
], ],
@ -167,7 +166,7 @@ return [
'monitorBackups' => [ 'monitorBackups' => [
[ [
'name' => config('app.name'), 'name' => config('app.name'),
'disks' => ['local'], 'disks' => [env('PRIVATE_FILESYSTEM_DISK', 'local')],
'newestBackupsShouldNotBeOlderThanDays' => 1, 'newestBackupsShouldNotBeOlderThanDays' => 1,
'storageUsedMayNotBeHigherThanMegabytes' => 5000, 'storageUsedMayNotBeHigherThanMegabytes' => 5000,
], ],
@ -214,7 +213,7 @@ return [
/* /*
* The number of months for which one monthly backup must be kept. * 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. * The number of years for which one yearly backup must be kept.

View file

@ -92,6 +92,11 @@ $config = [
'url_type' => env('RACKSPACE_URL_TYPE'), 'url_type' => env('RACKSPACE_URL_TYPE'),
], ],
'backup' => [
'driver' => env('PRIVATE_FILESYSTEM_DISK', 'local'),
'root' => storage_path('app'),
],
], ],
]; ];