mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
52 lines
1022 B
PHP
52 lines
1022 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Repositories\ToolRepository;
|
|
use Illuminate\Console\Command;
|
|
|
|
class BackupCronjob extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'backup:cronjob';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Backup all data cronjob, and upload to Google drive.';
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
$rep = new ToolRepository();
|
|
$result = $rep->cronjobBackup();
|
|
$log = sprintf(
|
|
'[%s], %s, result: %s',
|
|
REQUEST_ID, __METHOD__, var_export($result, true)
|
|
);
|
|
$this->info($log);
|
|
do_log($log);
|
|
return 0;
|
|
}
|
|
}
|