Skip to content

Commit

Permalink
Fixes for backups
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Aug 28, 2020
1 parent bc5a82e commit 5aaa243
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
23 changes: 16 additions & 7 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1008,19 +1008,28 @@ public function postSamlSettings(SettingsSamlRequest $request)
*/
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]),
];

}


}
}

Expand Down
9 changes: 4 additions & 5 deletions config/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -78,7 +77,7 @@
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
*/
'databases' => [
'mysql',
env('DB_CONNECTION', 'mysql'),
],
],

Expand Down Expand Up @@ -106,7 +105,7 @@
* The disk names on which the backups will be stored.
*/
'disks' => [
'local',
'backup',
],
],

Expand Down Expand Up @@ -167,7 +166,7 @@
'monitorBackups' => [
[
'name' => config('app.name'),
'disks' => ['local'],
'disks' => [env('PRIVATE_FILESYSTEM_DISK', 'local')],
'newestBackupsShouldNotBeOlderThanDays' => 1,
'storageUsedMayNotBeHigherThanMegabytes' => 5000,
],
Expand Down Expand Up @@ -214,7 +213,7 @@
/*
* 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.
Expand Down
5 changes: 5 additions & 0 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
'url_type' => env('RACKSPACE_URL_TYPE'),
],

'backup' => [
'driver' => env('PRIVATE_FILESYSTEM_DISK', 'local'),
'root' => storage_path('app'),
],

],

];
Expand Down

0 comments on commit 5aaa243

Please sign in to comment.