Files
InvoiceShelf/app/Platform/Storage/Jobs/CreateBackupJob.php
T
Darko Gjorgjijoski 5ef7804e60 refactor: adopt modular domain architecture (#747)
* refactor: stabilize model identities for domain migration

* refactor: extract module platform context

* refactor: assign models to domain contexts

* refactor: extract ai platform context

* refactor: extract storage platform context

* refactor: extract mail platform context

* refactor: extract pdf platform context

* refactor: extract operations platform context

* refactor: move installation into operations platform

* refactor: extract money domain context

* refactor: extract taxation domain context

* refactor: extract catalog domain context

* refactor: extract metadata domain context

* refactor: extract reporting domain context

* refactor: extract purchases domain context

* refactor: extract receivables domain context

* refactor: extract accounts domain context

* refactor: complete reporting statement boundary

* refactor: extract contacts domain context

* refactor: extract sales domain context

* refactor: remove legacy application layers

* fix: migrate legacy bouncer role identities
2026-08-05 17:40:03 +02:00

60 lines
1.4 KiB
PHP

<?php
namespace App\Platform\Storage\Jobs;
use App\Platform\Storage\Application\BackupConfigurationFactory;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Spatie\Backup\Tasks\Backup\BackupJobFactory;
class CreateBackupJob implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
protected $data;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($data = [])
{
$this->data = $data;
}
/**
* Execute the job.
*/
public function handle(): void
{
$config = BackupConfigurationFactory::make($this->data);
$backupJob = BackupJobFactory::createFromConfig($config);
if (! defined('SIGINT')) {
$backupJob->disableSignals();
}
if ($this->data['option'] === 'only-db') {
$backupJob->dontBackupFilesystem();
}
if ($this->data['option'] === 'only-files') {
$backupJob->dontBackupDatabases();
}
if (! empty($this->data['option'])) {
$prefix = str_replace('_', '-', $this->data['option']).'-';
$backupJob->setFilename($prefix.date('Y-m-d-H-i-s').'.zip');
}
$backupJob->run();
}
}