backup add feature: upload to google drive

This commit is contained in:
xiaomlove
2021-05-11 01:41:58 +08:00
parent 3e4471f533
commit fa57e78c74
8 changed files with 26 additions and 13 deletions

View File

@@ -12,14 +12,14 @@ class BackuAll extends Command
*
* @var string
*/
protected $signature = 'backup:all';
protected $signature = 'backup:all {--upload-to-google-drive}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Backup all data, include web root and database';
protected $description = 'Backup all data, include web root and database. options: --upload-to-google-drive';
/**
* Create a new command instance.
@@ -38,9 +38,13 @@ class BackuAll extends Command
*/
public function handle()
{
$uploadToGoogleDrive = $this->option('upload-to-google-drive');
$rep = new ToolRepository();
$result = $rep->backupAll();
$log = sprintf('[%s], %s, result: %s', REQUEST_ID, __METHOD__, var_export($result, true));
$result = $rep->backupAll($uploadToGoogleDrive);
$log = sprintf(
'[%s], %s, uploadToGoogleDrive: %s, result: %s',
REQUEST_ID, __METHOD__, var_export($uploadToGoogleDrive, true), var_export($result, true)
);
$this->info($log);
do_log($log);
}

View File

@@ -58,7 +58,7 @@ class Test extends Command
// $rep->assignCronjob();
// $r = $rep->cronjobCheckout();
$disk = Storage::disk('google_dirve');
$r = $disk->files();
$r = $disk->put('/', base_path('composer.json'));
dd($r);
}