Changes
This commit is contained in:
@@ -28,6 +28,8 @@ RUN apt-get update && apt-get install -y zlib1g-dev libicu-dev g++
|
|||||||
RUN docker-php-ext-configure intl
|
RUN docker-php-ext-configure intl
|
||||||
RUN docker-php-ext-install intl
|
RUN docker-php-ext-install intl
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y default-mysql-client
|
||||||
|
|
||||||
|
|
||||||
# Копирование конфигурационного файла PHP
|
# Копирование конфигурационного файла PHP
|
||||||
COPY ./_docker/app/php.ini /usr/local/etc/php/conf.d/php.ini
|
COPY ./_docker/app/php.ini /usr/local/etc/php/conf.d/php.ini
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
use App\Jobs\RunBackup;
|
||||||
|
use Filament\Actions\Action;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
|
use Filament\Pages\Page;
|
||||||
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
|
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
|
||||||
|
|
||||||
|
use ShuvroRoy\FilamentSpatieLaravelBackup\Pages\Backups as BaseBackups;
|
||||||
|
|
||||||
|
|
||||||
|
class Backups extends BaseBackups
|
||||||
|
{
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-cog';
|
||||||
|
|
||||||
|
protected static string $view = 'filament.pages.backup';
|
||||||
|
|
||||||
|
public function getHeading(): string | Htmlable
|
||||||
|
{
|
||||||
|
return __('filament-spatie-backup::backup.pages.backups.heading');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationGroup(): ?string
|
||||||
|
{
|
||||||
|
return 'Settings';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
|
{
|
||||||
|
return __('filament-spatie-backup::backup.pages.backups.navigation.label');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Action::make('Create Backup')
|
||||||
|
->button()
|
||||||
|
->label(__('filament-spatie-backup::backup.pages.backups.actions.create_backup'))
|
||||||
|
->action('create'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function openOptionModal(): void
|
||||||
|
{
|
||||||
|
$this->dispatch('open-modal', id: 'backup-option');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(string $option = ''): void
|
||||||
|
{
|
||||||
|
RunBackup::dispatch();
|
||||||
|
|
||||||
|
Notification::make()
|
||||||
|
->title('Резервная копия создается в фоновом режиме')
|
||||||
|
->success()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
$this->dispatch('close-modal', id: 'backup-option');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function shouldDisplayStatusListRecords(): bool
|
||||||
|
{
|
||||||
|
/** @var FilamentSpatieLaravelBackupPlugin $plugin */
|
||||||
|
$plugin = filament()->getPlugin('filament-spatie-backup');
|
||||||
|
|
||||||
|
return $plugin->hasStatusListRecordsTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
|
class RunBackup implements ShouldQueue
|
||||||
|
{
|
||||||
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new job instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the job.
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$exitCode = Artisan::call('backup:run', [
|
||||||
|
'--quiet' => true, // Уберите это, если хотите видеть более подробный вывод
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Логируем вывод
|
||||||
|
Log::info('Backup command output: ' . Artisan::output());
|
||||||
|
Log::error('Backup command exit code: ' . $exitCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Providers\Filament;
|
namespace App\Providers\Filament;
|
||||||
|
|
||||||
|
use App\Filament\Pages\Backups;
|
||||||
use Filament\Http\Middleware\Authenticate;
|
use Filament\Http\Middleware\Authenticate;
|
||||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||||
@@ -17,6 +18,7 @@ use Illuminate\Routing\Middleware\SubstituteBindings;
|
|||||||
use Illuminate\Session\Middleware\AuthenticateSession;
|
use Illuminate\Session\Middleware\AuthenticateSession;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
|
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
|
|
||||||
@@ -58,7 +60,8 @@ class AdminPanelProvider extends PanelProvider
|
|||||||
Authenticate::class,
|
Authenticate::class,
|
||||||
])
|
])
|
||||||
->plugins([
|
->plugins([
|
||||||
\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make()
|
\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make(),
|
||||||
|
FilamentSpatieLaravelBackupPlugin::make()->usingPage(Backups::class),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"nesbot/carbon": "^2.71",
|
"nesbot/carbon": "^2.71",
|
||||||
"protonemedia/laravel-cross-eloquent-search": "^3.4",
|
"protonemedia/laravel-cross-eloquent-search": "^3.4",
|
||||||
"pxlrbt/filament-excel": "^2.3",
|
"pxlrbt/filament-excel": "^2.3",
|
||||||
|
"shuvroroy/filament-spatie-laravel-backup": "^2.2",
|
||||||
"spatie/laravel-sitemap": "^7.2",
|
"spatie/laravel-sitemap": "^7.2",
|
||||||
"symfony/filesystem": "^6.3",
|
"symfony/filesystem": "^6.3",
|
||||||
"tightenco/ziggy": "^1.0",
|
"tightenco/ziggy": "^1.0",
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<x-filament-panels::page>
|
||||||
|
<div class="flex flex-col gap-y-8">
|
||||||
|
@if($this->shouldDisplayStatusListRecords())
|
||||||
|
<div class="mb-10">
|
||||||
|
@livewire(ShuvroRoy\FilamentSpatieLaravelBackup\Components\BackupDestinationStatusListRecords::class)
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<div>
|
||||||
|
@livewire(ShuvroRoy\FilamentSpatieLaravelBackup\Components\BackupDestinationListRecords::class)
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<x-filament::modal id="backup-option" width="lg">
|
||||||
|
<x-slot name="heading">
|
||||||
|
<h3 class="text-xl">{{ __('filament-spatie-backup::backup.pages.backups.modal.label') }}</h3>
|
||||||
|
</x-slot>
|
||||||
|
|
||||||
|
<x-slot name="footer" >
|
||||||
|
<div class="flex gap-x-2">
|
||||||
|
<x-filament::button wire:click="create('only-db')" color="primary" class="w-full">
|
||||||
|
{{ __('filament-spatie-backup::backup.pages.backups.modal.buttons.only_db') }}
|
||||||
|
</x-filament::button>
|
||||||
|
|
||||||
|
<x-filament::button wire:click="create('only-files')" color="info" class="w-full">
|
||||||
|
{{ __('filament-spatie-backup::backup.pages.backups.modal.buttons.only_files') }}
|
||||||
|
</x-filament::button>
|
||||||
|
|
||||||
|
<x-filament::button wire:click="create()" color="success" class="w-full">
|
||||||
|
{{ __('filament-spatie-backup::backup.pages.backups.modal.buttons.db_and_files') }}
|
||||||
|
</x-filament::button>
|
||||||
|
</div>
|
||||||
|
</x-slot>
|
||||||
|
</x-filament::modal>
|
||||||
|
</div>
|
||||||
|
</x-filament-panels::page>
|
||||||
Reference in New Issue
Block a user