2021-05-02 17:24:05 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
|
|
use App\Repositories\ToolRepository;
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
|
|
class BackupWeb extends Command
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name and signature of the console command.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2022-09-18 17:20:51 +08:00
|
|
|
protected $signature = 'backup:web {--method=} {--transfer=}';
|
2021-05-02 17:24:05 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The console command description.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2022-05-14 15:19:10 +08:00
|
|
|
protected $description = 'BackupWeb web data, options: --method';
|
2021-05-02 17:24:05 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new command instance.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
parent::__construct();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Execute the console command.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
2022-05-14 15:19:10 +08:00
|
|
|
$method = $this->option('method');
|
2022-09-18 17:20:51 +08:00
|
|
|
$transfer = $this->option('transfer');
|
|
|
|
|
$this->info("method: $method, transfer: $transfer");
|
2021-05-02 17:24:05 +08:00
|
|
|
$rep = new ToolRepository();
|
2022-09-18 17:20:51 +08:00
|
|
|
$result = $rep->backupWeb($method, $transfer);
|
2022-03-20 22:14:00 +08:00
|
|
|
$log = sprintf('[%s], %s, result: %s', nexus()->getRequestId(), __METHOD__, var_export($result, true));
|
2021-05-02 17:24:05 +08:00
|
|
|
$this->info($log);
|
|
|
|
|
do_log($log);
|
|
|
|
|
}
|
|
|
|
|
}
|