We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -1,12 +1,7 @@ |
||
1 | 1 | <?php namespace Backpack\BackupManager\app\Http\Controllers; |
2 | 2 | |
3 | -use App\Http\Requests; |
|
4 | 3 | use App\Http\Controllers\Controller; |
5 | -use Illuminate\Http\Request; |
|
6 | -use Auth; |
|
7 | -use App; |
|
8 | 4 | use Storage; |
9 | -use Carbon\Carbon; |
|
10 | 5 | use Artisan; |
11 | 6 | use Log; |
12 | 7 |
@@ -12,83 +12,83 @@ |
||
12 | 12 | |
13 | 13 | class BackupController extends Controller { |
14 | 14 | |
15 | - public function index() |
|
16 | - { |
|
17 | - $disk = Storage::disk(config('laravel-backup.backup.destination.disks')[0]); |
|
18 | - // dd($disk); |
|
19 | - $files = $disk->files(); |
|
20 | - $this->data['backups'] = []; |
|
15 | + public function index() |
|
16 | + { |
|
17 | + $disk = Storage::disk(config('laravel-backup.backup.destination.disks')[0]); |
|
18 | + // dd($disk); |
|
19 | + $files = $disk->files(); |
|
20 | + $this->data['backups'] = []; |
|
21 | 21 | |
22 | - // make an array of backup files, with their filesize and creation date |
|
23 | - foreach ($files as $k => $f) { |
|
24 | - // only take the zip files into account |
|
25 | - if (substr($f, -4) == '.zip' && $disk->exists($f)) { |
|
26 | - $this->data['backups'][] = [ |
|
27 | - 'file_path' => $f, |
|
28 | - 'file_name' => str_replace('backups/', '', $f), |
|
29 | - 'file_size' => $disk->size($f), |
|
30 | - 'last_modified' => $disk->lastModified($f), |
|
31 | - ]; |
|
32 | - } |
|
33 | - } |
|
22 | + // make an array of backup files, with their filesize and creation date |
|
23 | + foreach ($files as $k => $f) { |
|
24 | + // only take the zip files into account |
|
25 | + if (substr($f, -4) == '.zip' && $disk->exists($f)) { |
|
26 | + $this->data['backups'][] = [ |
|
27 | + 'file_path' => $f, |
|
28 | + 'file_name' => str_replace('backups/', '', $f), |
|
29 | + 'file_size' => $disk->size($f), |
|
30 | + 'last_modified' => $disk->lastModified($f), |
|
31 | + ]; |
|
32 | + } |
|
33 | + } |
|
34 | 34 | |
35 | - // reverse the backups, so the newest one would be on top |
|
36 | - $this->data['backups'] = array_reverse($this->data['backups']); |
|
35 | + // reverse the backups, so the newest one would be on top |
|
36 | + $this->data['backups'] = array_reverse($this->data['backups']); |
|
37 | 37 | |
38 | - return view("backupmanager::backup", $this->data); |
|
39 | - } |
|
38 | + return view("backupmanager::backup", $this->data); |
|
39 | + } |
|
40 | 40 | |
41 | - public function create() |
|
42 | - { |
|
43 | - try { |
|
44 | - // start the backup process |
|
45 | - Artisan::call('backup:run'); |
|
46 | - $output = Artisan::output(); |
|
47 | - // $output = "backup failed"; |
|
48 | - // log the results |
|
49 | - Log::info("Backpack\BackupManager -- new backup started from admin interface \r\n".$output); |
|
50 | - // return the results as a response to the ajax call |
|
51 | - echo($output); |
|
52 | - } catch (Exception $e) { |
|
53 | - Response::make($e->getMessage(), 500); |
|
54 | - } |
|
41 | + public function create() |
|
42 | + { |
|
43 | + try { |
|
44 | + // start the backup process |
|
45 | + Artisan::call('backup:run'); |
|
46 | + $output = Artisan::output(); |
|
47 | + // $output = "backup failed"; |
|
48 | + // log the results |
|
49 | + Log::info("Backpack\BackupManager -- new backup started from admin interface \r\n".$output); |
|
50 | + // return the results as a response to the ajax call |
|
51 | + echo($output); |
|
52 | + } catch (Exception $e) { |
|
53 | + Response::make($e->getMessage(), 500); |
|
54 | + } |
|
55 | 55 | |
56 | - // return 'success'; |
|
57 | - } |
|
56 | + // return 'success'; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Downloads a backup zip file. |
|
61 | - * |
|
62 | - * TODO: make it work no matter the flysystem driver (S3 Bucket, etc). |
|
63 | - */ |
|
64 | - public function download($file_name) |
|
65 | - { |
|
66 | - $disk = Storage::disk(config('laravel-backup.backup.destination.disks')[0]); |
|
59 | + /** |
|
60 | + * Downloads a backup zip file. |
|
61 | + * |
|
62 | + * TODO: make it work no matter the flysystem driver (S3 Bucket, etc). |
|
63 | + */ |
|
64 | + public function download($file_name) |
|
65 | + { |
|
66 | + $disk = Storage::disk(config('laravel-backup.backup.destination.disks')[0]); |
|
67 | 67 | |
68 | - if ($disk->exists($file_name)) { |
|
69 | - return response()->download(storage_path('backups/'.$file_name)); |
|
70 | - } |
|
71 | - else |
|
72 | - { |
|
73 | - abort(404, "The backup file doesn't exist."); |
|
74 | - } |
|
75 | - } |
|
68 | + if ($disk->exists($file_name)) { |
|
69 | + return response()->download(storage_path('backups/'.$file_name)); |
|
70 | + } |
|
71 | + else |
|
72 | + { |
|
73 | + abort(404, "The backup file doesn't exist."); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * Deletes a backup file. |
|
79 | - */ |
|
80 | - public function delete($file_name) |
|
81 | - { |
|
82 | - $disk = Storage::disk(config('laravel-backup.backup.destination.disks')[0]); |
|
77 | + /** |
|
78 | + * Deletes a backup file. |
|
79 | + */ |
|
80 | + public function delete($file_name) |
|
81 | + { |
|
82 | + $disk = Storage::disk(config('laravel-backup.backup.destination.disks')[0]); |
|
83 | 83 | |
84 | - if ($disk->exists($file_name)) { |
|
85 | - $disk->delete($file_name); |
|
84 | + if ($disk->exists($file_name)) { |
|
85 | + $disk->delete($file_name); |
|
86 | 86 | |
87 | - return 'success'; |
|
88 | - } |
|
89 | - else |
|
90 | - { |
|
91 | - abort(404, "The backup file doesn't exist."); |
|
92 | - } |
|
93 | - } |
|
87 | + return 'success'; |
|
88 | + } |
|
89 | + else |
|
90 | + { |
|
91 | + abort(404, "The backup file doesn't exist."); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | } |
@@ -67,8 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | if ($disk->exists($file_name)) { |
69 | 69 | return response()->download(storage_path('backups/'.$file_name)); |
70 | - } |
|
71 | - else |
|
70 | + } else |
|
72 | 71 | { |
73 | 72 | abort(404, "The backup file doesn't exist."); |
74 | 73 | } |
@@ -85,8 +84,7 @@ discard block |
||
85 | 84 | $disk->delete($file_name); |
86 | 85 | |
87 | 86 | return 'success'; |
88 | - } |
|
89 | - else |
|
87 | + } else |
|
90 | 88 | { |
91 | 89 | abort(404, "The backup file doesn't exist."); |
92 | 90 | } |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | $this->loadViewsFrom(realpath(__DIR__.'/resources/views'), 'backupmanager'); |
31 | 31 | |
32 | 32 | // publish config file |
33 | - $this->publishes([ __DIR__.'/config/laravel-backup.php' => config_path('laravel-backup.php'), ], 'config'); |
|
33 | + $this->publishes([__DIR__.'/config/laravel-backup.php' => config_path('laravel-backup.php'), ], 'config'); |
|
34 | 34 | // publish lang files |
35 | - $this->publishes([ __DIR__.'/resources/lang' => resource_path('lang/vendor/backpack'), ], 'lang'); |
|
35 | + $this->publishes([__DIR__.'/resources/lang' => resource_path('lang/vendor/backpack'), ], 'lang'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | private function registerBackupManager() |
69 | 69 | { |
70 | - $this->app->bind('backupmanager',function($app){ |
|
70 | + $this->app->bind('backupmanager', function($app) { |
|
71 | 71 | return new BackupManager($app); |
72 | 72 | }); |
73 | 73 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /* |
|
5 | + /* |
|
6 | 6 | |-------------------------------------------------------------------------- |
7 | 7 | | Backup Language Lines |
8 | 8 | |-------------------------------------------------------------------------- |
@@ -12,25 +12,25 @@ discard block |
||
12 | 12 | | |
13 | 13 | */ |
14 | 14 | |
15 | - 'backup' => 'Backup', |
|
16 | - 'create_a_new_backup' => 'Create a new backup', |
|
17 | - 'existing_backups' => 'Existing backups', |
|
18 | - 'date' => 'Date', |
|
19 | - 'file_size' => 'File size', |
|
20 | - 'actions' => 'Actions', |
|
21 | - 'download' => 'Download', |
|
22 | - 'delete' => 'Delete', |
|
23 | - 'delete_confirm' => 'Are your sure you want to delete this backup file?', |
|
24 | - 'delete_confirmation_title' => 'Done', |
|
25 | - 'delete_confirmation_message' => 'The backup was file deleted.', |
|
26 | - 'delete_error_title' => 'Error', |
|
27 | - 'delete_error_message' => 'The backup file has NOT been deleted.', |
|
28 | - 'delete_cancel_title' => "It's ok", |
|
29 | - 'delete_cancel_message' => 'The backup file has NOT been deleted.', |
|
30 | - 'create_confirmation_title' => 'Backup completed', |
|
31 | - 'create_confirmation_message' => 'Reloading the page in 3 seconds.', |
|
32 | - 'create_error_title' => 'Backup error', |
|
33 | - 'create_error_message' => 'The backup was file could NOT be created.', |
|
34 | - 'create_warning_title' => 'Unknown error', |
|
35 | - 'create_warning_message' => 'Your backup may NOT have been created. Please check log files for details.', |
|
15 | + 'backup' => 'Backup', |
|
16 | + 'create_a_new_backup' => 'Create a new backup', |
|
17 | + 'existing_backups' => 'Existing backups', |
|
18 | + 'date' => 'Date', |
|
19 | + 'file_size' => 'File size', |
|
20 | + 'actions' => 'Actions', |
|
21 | + 'download' => 'Download', |
|
22 | + 'delete' => 'Delete', |
|
23 | + 'delete_confirm' => 'Are your sure you want to delete this backup file?', |
|
24 | + 'delete_confirmation_title' => 'Done', |
|
25 | + 'delete_confirmation_message' => 'The backup was file deleted.', |
|
26 | + 'delete_error_title' => 'Error', |
|
27 | + 'delete_error_message' => 'The backup file has NOT been deleted.', |
|
28 | + 'delete_cancel_title' => "It's ok", |
|
29 | + 'delete_cancel_message' => 'The backup file has NOT been deleted.', |
|
30 | + 'create_confirmation_title' => 'Backup completed', |
|
31 | + 'create_confirmation_message' => 'Reloading the page in 3 seconds.', |
|
32 | + 'create_error_title' => 'Backup error', |
|
33 | + 'create_error_message' => 'The backup was file could NOT be created.', |
|
34 | + 'create_warning_title' => 'Unknown error', |
|
35 | + 'create_warning_message' => 'Your backup may NOT have been created. Please check log files for details.', |
|
36 | 36 | ]; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | return [ |
4 | 4 | |
5 | - /* |
|
5 | + /* |
|
6 | 6 | |-------------------------------------------------------------------------- |
7 | 7 | | Backup Language Lines |
8 | 8 | |-------------------------------------------------------------------------- |
@@ -12,25 +12,25 @@ discard block |
||
12 | 12 | | |
13 | 13 | */ |
14 | 14 | |
15 | - 'backup' => 'Copii de siguranță', |
|
16 | - 'create_a_new_backup' => 'Creează o nouă copie de siguranță', |
|
17 | - 'existing_backups' => 'Copii existente', |
|
18 | - 'date' => 'Data', |
|
19 | - 'file_size' => 'Mărimea fișierului', |
|
20 | - 'actions' => 'Acțiuni', |
|
21 | - 'download' => 'Descarcă', |
|
22 | - 'delete' => 'Șterge', |
|
23 | - 'delete_confirm' => 'Ești sigur că vrei să ștergi copia de siguranță?', |
|
24 | - 'delete_confirmation_title' => 'Operațiune reușită', |
|
25 | - 'delete_confirmation_message' => 'Copia de siguranță a fost ștearsă.', |
|
26 | - 'delete_error_title' => 'Eroare', |
|
27 | - 'delete_error_message' => 'Copia de siguranță NU a fost ștearsă.', |
|
28 | - 'delete_cancel_title' => "Este în regulă", |
|
29 | - 'delete_cancel_message' => 'Copia de siguranță NU a fost ștearsă.', |
|
30 | - 'create_confirmation_title' => 'Operațiune reușită', |
|
31 | - 'create_confirmation_message' => 'Copia de siguranță a fost creeată cu succes.', |
|
32 | - 'create_error_title' => 'Eroare', |
|
33 | - 'create_error_message' => 'Copia de siguranță NU a putut fi creată.', |
|
34 | - 'create_warning_title' => 'Eroare necunoscută', |
|
35 | - 'create_warning_message' => 'Copia de siguranță e posibil să NU fi fost creată. Verificați fișierele de log pentru detalii.', |
|
15 | + 'backup' => 'Copii de siguranță', |
|
16 | + 'create_a_new_backup' => 'Creează o nouă copie de siguranță', |
|
17 | + 'existing_backups' => 'Copii existente', |
|
18 | + 'date' => 'Data', |
|
19 | + 'file_size' => 'Mărimea fișierului', |
|
20 | + 'actions' => 'Acțiuni', |
|
21 | + 'download' => 'Descarcă', |
|
22 | + 'delete' => 'Șterge', |
|
23 | + 'delete_confirm' => 'Ești sigur că vrei să ștergi copia de siguranță?', |
|
24 | + 'delete_confirmation_title' => 'Operațiune reușită', |
|
25 | + 'delete_confirmation_message' => 'Copia de siguranță a fost ștearsă.', |
|
26 | + 'delete_error_title' => 'Eroare', |
|
27 | + 'delete_error_message' => 'Copia de siguranță NU a fost ștearsă.', |
|
28 | + 'delete_cancel_title' => "Este în regulă", |
|
29 | + 'delete_cancel_message' => 'Copia de siguranță NU a fost ștearsă.', |
|
30 | + 'create_confirmation_title' => 'Operațiune reușită', |
|
31 | + 'create_confirmation_message' => 'Copia de siguranță a fost creeată cu succes.', |
|
32 | + 'create_error_title' => 'Eroare', |
|
33 | + 'create_error_message' => 'Copia de siguranță NU a putut fi creată.', |
|
34 | + 'create_warning_title' => 'Eroare necunoscută', |
|
35 | + 'create_warning_message' => 'Copia de siguranță e posibil să NU fi fost creată. Verificați fișierele de log pentru detalii.', |
|
36 | 36 | ]; |
@@ -3,10 +3,10 @@ |
||
3 | 3 | Route::group(['prefix' => 'admin', 'middleware' => ['web', 'auth']], function() |
4 | 4 | { |
5 | 5 | |
6 | - // Backup |
|
7 | - Route::get('backup', 'BackupController@index'); |
|
8 | - Route::put('backup/create', 'BackupController@create'); |
|
9 | - Route::get('backup/download/{file_name}', 'BackupController@download'); |
|
10 | - Route::delete('backup/delete/{file_name}', 'BackupController@delete'); |
|
6 | + // Backup |
|
7 | + Route::get('backup', 'BackupController@index'); |
|
8 | + Route::put('backup/create', 'BackupController@create'); |
|
9 | + Route::get('backup/download/{file_name}', 'BackupController@download'); |
|
10 | + Route::delete('backup/delete/{file_name}', 'BackupController@delete'); |
|
11 | 11 | |
12 | 12 | }); |
13 | 13 | \ No newline at end of file |