mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
ba462d1e93
Signed-off-by: snipe <snipe@snipe.net>
55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
class SystemBackup extends Command
|
|
{
|
|
/**
|
|
* The console command name.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'snipeit:backup {--filename=}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'This command creates a database dump and zips up all of the uploaded files in the upload directories.';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
if ($this->option('filename')) {
|
|
$filename = $this->option('filename');
|
|
|
|
// Make sure the filename ends in .zip
|
|
if (!ends_with($filename, '.zip')) {
|
|
$filename = $filename.'.zip';
|
|
}
|
|
|
|
$this->call('backup:run', ['--filename' => $filename]);
|
|
} else {
|
|
$this->call('backup:run');
|
|
}
|
|
|
|
}
|
|
}
|