mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-01-30 15:59:28 -06:00
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D Community Edition
|
|
*
|
|
* @author HDVinnie <hdinnovations@protonmail.com>
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
*/
|
|
|
|
namespace App\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Spatie\Backup\Tasks\Backup\BackupJobFactory;
|
|
|
|
class ProcessBackup implements ShouldQueue
|
|
{
|
|
use Dispatchable;
|
|
use InteractsWithQueue;
|
|
use Queueable;
|
|
|
|
public $timeout = 0;
|
|
|
|
public function __construct(protected $option = '')
|
|
{
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$backupJob = BackupJobFactory::createFromArray(config('backup'));
|
|
|
|
if ($this->option === 'only-db') {
|
|
$backupJob->dontBackupFilesystem();
|
|
}
|
|
|
|
if ($this->option === 'only-files') {
|
|
$backupJob->dontBackupDatabases();
|
|
}
|
|
|
|
if (! empty($this->option)) {
|
|
$prefix = str_replace('_', '-', $this->option).'-';
|
|
|
|
$backupJob->setFilename($prefix.date('Y-m-d-H-i-s').'.zip');
|
|
}
|
|
|
|
$backupJob->run();
|
|
}
|
|
}
|