Skip to content

Commit

Permalink
Merge pull request #442 from nasirkhan/dev
Browse files Browse the repository at this point in the history
Backup config update and cleanup schedule added
  • Loading branch information
nasirkhan authored Jul 27, 2023
2 parents 087044a + 4a11890 commit 7963346
Show file tree
Hide file tree
Showing 8 changed files with 172 additions and 57 deletions.
3 changes: 3 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();

// Backup Cleanup
$schedule->command('backup:clean')->daily()->at('01:00');
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Backend/BackupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function create()
Log::info("Backpack\BackupManager -- new backup started from admin interface \r\n".$output);

// return the results as a response to the ajax call
flash("<i class='fas fa-check'></i> New backup created")->success()->important();
flash(icon().'New backup created')->success()->important();

return redirect()->back();
} catch (Exception $e) {
Expand Down Expand Up @@ -142,6 +142,8 @@ public function delete($file_name)
if ($disk->exists($file)) {
$disk->delete($file);

flash(icon()."`$file_name` deleted successfully.")->success()->important();

return redirect()->back();
} else {
abort(404, "The backup file doesn't exist.");
Expand Down
13 changes: 10 additions & 3 deletions config/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* Directories used by the backup process will automatically be excluded.
*/
'exclude' => [
base_path('.git'),
base_path('vendor'),
base_path('node_modules'),
],
Expand Down Expand Up @@ -85,7 +86,7 @@
],

/*
* The database dump can be compressed to decrease diskspace usage.
* The database dump can be compressed to decrease disk space usage.
*
* Out of the box Laravel-backup supplies
* Spatie\DbDumper\Compressors\GzipCompressor::class.
Expand Down Expand Up @@ -191,9 +192,15 @@
'discord' => [
'webhook_url' => '',

'username' => null,
/*
* If this is an empty string, the name field on the webhook will be used.
*/
'username' => '',

'avatar_url' => null,
/*
* If this is an empty string, the avatar on the webhook will be used.
*/
'avatar_url' => '',
],
],

Expand Down
45 changes: 45 additions & 0 deletions lang/vendor/backup/he/notifications.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

return [
'exception_message' => 'הודעת חריגה: :message',
'exception_trace' => 'מעקב חריגה: :trace',
'exception_message_title' => 'הודעת חריגה',
'exception_trace_title' => 'מעקב חריגה',

'backup_failed_subject' => 'כשל בגיבוי של :application_name',
'backup_failed_body' => 'חשוב: אירעה שגיאה במהלך גיבוי היישום :application_name',

'backup_successful_subject' => 'גיבוי חדש מוצלח של :application_name',
'backup_successful_subject_title' => 'גיבוי חדש מוצלח!',
'backup_successful_body' => 'חדשות טובות, גיבוי חדש של :application_name נוצר בהצלחה על הדיסק בשם :disk_name.',

'cleanup_failed_subject' => 'נכשל בניקוי הגיבויים של :application_name',
'cleanup_failed_body' => 'אירעה שגיאה במהלך ניקוי הגיבויים של :application_name',

'cleanup_successful_subject' => 'ניקוי הגיבויים של :application_name בוצע בהצלחה',
'cleanup_successful_subject_title' => 'ניקוי הגיבויים בוצע בהצלחה!',
'cleanup_successful_body' => 'ניקוי הגיבויים של :application_name על הדיסק בשם :disk_name בוצע בהצלחה.',

'healthy_backup_found_subject' => 'הגיבויים של :application_name על הדיסק :disk_name תקינים',
'healthy_backup_found_subject_title' => 'הגיבויים של :application_name תקינים',
'healthy_backup_found_body' => 'הגיבויים של :application_name נחשבים לתקינים. עבודה טובה!',

'unhealthy_backup_found_subject' => 'חשוב: הגיבויים של :application_name אינם תקינים',
'unhealthy_backup_found_subject_title' => 'חשוב: הגיבויים של :application_name אינם תקינים. :problem',
'unhealthy_backup_found_body' => 'הגיבויים של :application_name על הדיסק :disk_name אינם תקינים.',
'unhealthy_backup_found_not_reachable' => 'לא ניתן להגיע ליעד הגיבוי. :error',
'unhealthy_backup_found_empty' => 'אין גיבויים של היישום הזה בכלל.',
'unhealthy_backup_found_old' => 'הגיבוי האחרון שנעשה בתאריך :date נחשב כישן מדי.',
'unhealthy_backup_found_unknown' => 'מצטערים, לא ניתן לקבוע סיבה מדויקת.',
'unhealthy_backup_found_full' => 'הגיבויים משתמשים בשטח אחסון רב מידי. שימוש הנוכחי הוא :disk_usage, שגבול המותר הוא :disk_limit.',

'no_backups_info' => 'לא נעשו עדיין גיבויים',
'application_name' => 'שם היישום',
'backup_name' => 'שם הגיבוי',
'disk' => 'דיסק',
'newest_backup_size' => 'גודל הגיבוי החדש ביותר',
'number_of_backups' => 'מספר הגיבויים',
'total_storage_used' => 'סך האחסון המופעל',
'newest_backup_date' => 'תאריך הגיבוי החדש ביותר',
'oldest_backup_date' => 'תאריך הגיבוי הישן ביותר',
];
45 changes: 45 additions & 0 deletions lang/vendor/backup/hr/notifications.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

return [
'exception_message' => 'Greška: :message',
'exception_trace' => 'Praćenje greške: :trace',
'exception_message_title' => 'Greška',
'exception_trace_title' => 'Praćenje greške',

'backup_failed_subject' => 'Neuspješno sigurnosno kopiranje za :application_name',
'backup_failed_body' => 'Važno: Došlo je do greške prilikom sigurnosnog kopiranja za :application_name',

'backup_successful_subject' => 'Uspješno sigurnosno kopiranje za :application_name',
'backup_successful_subject_title' => 'Uspješno sigurnosno kopiranje!',
'backup_successful_body' => 'Nova sigurnosna kopija za :application_name je uspješno spremljena na disk :disk_name.',

'cleanup_failed_subject' => 'Neuspješno čišćenje sigurnosnih kopija za :application_name',
'cleanup_failed_body' => 'Došlo je do greške prilikom čišćenja sigurnosnih kopija za :application_name',

'cleanup_successful_subject' => 'Uspješno čišćenje sigurnosnih kopija za :application_name',
'cleanup_successful_subject_title' => 'Uspješno čišćenje sigurnosnih kopija!',
'cleanup_successful_body' => 'Sigurnosne kopije za :application_name su uspješno očišćene s diska :disk_name.',

'healthy_backup_found_subject' => 'Sigurnosne kopije za :application_name na disku :disk_name su zdrave',
'healthy_backup_found_subject_title' => 'Sigurnosne kopije za :application_name su zdrave',
'healthy_backup_found_body' => 'Sigurnosne kopije za :application_name se smatraju zdravima. Svaka čast!',

'unhealthy_backup_found_subject' => 'Važno: Sigurnosne kopije za :application_name su nezdrave',
'unhealthy_backup_found_subject_title' => 'Važno: Sigurnosne kopije za :application_name su nezdrave. :problem',
'unhealthy_backup_found_body' => 'Sigurnosne kopije za :application_name na disku :disk_name su nezdrave.',
'unhealthy_backup_found_not_reachable' => 'Destinacija sigurnosne kopije nije dohvatljiva. :error',
'unhealthy_backup_found_empty' => 'Nijedna sigurnosna kopija ove aplikacije ne postoji.',
'unhealthy_backup_found_old' => 'Zadnja sigurnosna kopija generirana na datum :date smatra se prestarom.',
'unhealthy_backup_found_unknown' => 'Isprike, ali nije moguće odrediti razlog.',
'unhealthy_backup_found_full' => 'Sigurnosne kopije zauzimaju previše prostora. Trenutno zauzeće je :disk_usage što je više od dozvoljenog ograničenja od :disk_limit.',

'no_backups_info' => 'Nema sigurnosnih kopija',
'application_name' => 'Naziv aplikacije',
'backup_name' => 'Naziv sigurnosne kopije',
'disk' => 'Disk',
'newest_backup_size' => 'Veličina najnovije sigurnosne kopije',
'number_of_backups' => 'Broj sigurnosnih kopija',
'total_storage_used' => 'Ukupno zauzeće',
'newest_backup_date' => 'Najnovija kopija na datum',
'oldest_backup_date' => 'Najstarija kopija na datum',
];
103 changes: 52 additions & 51 deletions resources/views/backend/backups/backups.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,61 +31,62 @@
<div class="col">

@if (count($backups))
<table id="datatable" class="table table-bordered table-hover table-responsive-sm">
<thead>
<tr>
<th>
#
</th>
<th>
@lang('File')
</th>
<th>
@lang('Size')
</th>
<th>
@lang('Date')
</th>
<th>
@lang('Age')
</th>
<th class="text-end">
@lang('Action')
</th>
</tr>
</thead>
<div class="table-responsive">
<table id="datatable" class="table table-bordered table-hover">
<thead>
<tr>
<th>
#
</th>
<th>
@lang('File')
</th>
<th>
@lang('Size')
</th>
<th>
@lang('Date')
</th>
<th>
@lang('Age')
</th>
<th class="text-end">
@lang('Action')
</th>
</tr>
</thead>

<tbody>
@foreach($backups as $key => $backup)
<tr>
<td>
{{ ++$key }}
</td>
<td>
{{ $backup['file_name'] }}
</td>
<td>
{{ $backup['file_size'] }}
</td>
<td>
{{ $backup['date_created'] }}
</td>
<td>
{{ $backup['date_ago'] }}
</td>
<td class="text-end">
<a href="{{ route("backend.$module_name.download", $backup['file_name']) }}" class="btn btn-primary m-1 btn-sm" data-toggle="tooltip" title="@lang('Download File')"><i class="fas fa-cloud-download-alt"></i>&nbsp;@lang('Download')</a>
<tbody>
@foreach($backups as $key => $backup)
<tr>
<td>
{{ ++$key }}
</td>
<td>
{{ $backup['file_name'] }}
</td>
<td>
{{ $backup['file_size'] }}
</td>
<td>
{{ $backup['date_created'] }}
</td>
<td>
{{ $backup['date_ago'] }}
</td>
<td class="text-end">
<a href="{{ route("backend.$module_name.download", $backup['file_name']) }}" class="btn btn-primary m-1 btn-sm" data-toggle="tooltip" title="@lang('Download File')"><i class="fas fa-cloud-download-alt"></i>&nbsp;@lang('Download')</a>

<a href="{{ route("backend.$module_name.delete", $backup['file_name']) }}" class="btn btn-danger m-1 btn-sm" data-toggle="tooltip" title="@lang('Delete File')"><i class="fas fa-trash"></i>&nbsp;@lang('Delete')</a>

</td>
</tr>
@endforeach
</tbody>
</table>
<a href="{{ route("backend.$module_name.delete", $backup['file_name']) }}" class="btn btn-danger m-1 btn-sm" data-toggle="tooltip" title="@lang('Delete File')"><i class="fas fa-trash"></i>&nbsp;@lang('Delete')</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@else
<div class="text-center">
<h4>@lang('There are no backups')</h4>
<p>@lang('No backup has been created yet!')</p>
</div>
@endif

Expand Down
14 changes: 13 additions & 1 deletion resources/views/frontend/users/profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
</div>

@auth

@if (auth()->user()->id == $$module_name_singular->id)
<div class="mt-8">
<a href='{{ route("frontend.users.profileEdit", encode_id($$module_name_singular->id)) }}'>
Expand All @@ -69,6 +70,17 @@
</a>
</div>
@endif

@if (auth()->user()->username == $$module_name_singular->username)
<div class="mt-8">
<a href="{{ route('frontend.users.changePassword', $$module_name_singular->username) }}">
<div class="w-full text-sm px-6 py-2 transition ease-in duration-200 rounded text-gray-500 hover:bg-gray-800 hover:text-white border-2 border-gray-900 focus:outline-none">
Change Password
</div>
</a>
</div>
@endif

@endauth

</div>
Expand All @@ -90,7 +102,7 @@
<span class="">{{ $$module_name_singular->$field_name }}</span>
</div>
</div>

@auth
@if (auth()->user()->id == $$module_name_singular->id)
<div class="flex justify-between p-4">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/frontend/users/profileEdit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<div class="col-span-6 text-center">
<a href="{{ route('frontend.users.changePassword', encode_id($$module_name_singular->id)) }}">
<div class="w-full font-semibold text-sm px-6 py-2 transition ease-in duration-200 rounded text-gray-500 hover:bg-gray-800 hover:text-white border-2 border-gray-900 focus:outline-none">
Chnage Password
Change Password
</div>
</a>
</div>
Expand Down

0 comments on commit 7963346

Please sign in to comment.