Merge branch 'php8' into section

This commit is contained in:
xiaomlove
2022-10-25 19:16:56 +08:00
168 changed files with 3072 additions and 621 deletions

View File

@@ -12,7 +12,7 @@ class BackupDatabase extends Command
*
* @var string
*/
protected $signature = 'backup:database';
protected $signature = 'backup:database {--transfer=}';
/**
* The console command description.
@@ -39,7 +39,9 @@ class BackupDatabase extends Command
public function handle()
{
$rep = new ToolRepository();
$result = $rep->backupDatabase();
$transfer = $this->option('transfer');
$this->info("transfer: $transfer");
$result = $rep->backupDatabase($transfer);
$log = sprintf('[%s], %s, result: %s', nexus()->getRequestId(), __METHOD__, var_export($result, true));
$this->info($log);
do_log($log);

View File

@@ -12,7 +12,7 @@ class BackupWeb extends Command
*
* @var string
*/
protected $signature = 'backup:web {--method=}';
protected $signature = 'backup:web {--method=} {--transfer=}';
/**
* The console command description.
@@ -39,9 +39,10 @@ class BackupWeb extends Command
public function handle()
{
$method = $this->option('method');
$this->info("method: $method");
$transfer = $this->option('transfer');
$this->info("method: $method, transfer: $transfer");
$rep = new ToolRepository();
$result = $rep->backupWeb($method);
$result = $rep->backupWeb($method, $transfer);
$log = sprintf('[%s], %s, result: %s', nexus()->getRequestId(), __METHOD__, var_export($result, true));
$this->info($log);
do_log($log);

View File

@@ -44,8 +44,8 @@ class HitAndRunUpdateStatus extends Command
$rep = new HitAndRunRepository();
$result = $rep->cronjobUpdateStatus($uid, $torrentId, $ignoreTime);
$log = sprintf(
'[%s], %s, uid: %s, torrentId: %s, result: %s',
nexus()->getRequestId(), __METHOD__, $uid, $torrentId, var_export($result, true)
'[%s], %s, uid: %s, torrentId: %s, ignoreTime: %s, result: %s',
nexus()->getRequestId(), __METHOD__, $uid, $torrentId, $ignoreTime, var_export($result, true)
);
$this->info($log);
do_log($log);

View File

@@ -0,0 +1,42 @@
<?php
namespace App\Console\Commands;
use App\Repositories\PluginRepository;
use Illuminate\Console\Command;
use Nexus\Plugin\BasePlugin;
class PluginCronjob extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'plugin:cronjob {--action=} {--id=} {--force=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Plugin install / update / delete cronjob handler';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$action = $this->option('action');
$id = $this->option('id');
$force = $this->option('force');
$pluginRep = new PluginRepository();
$pluginRep->cronjob($action, $id, $force);
$log = sprintf("[%s], action: %s, id: %s, force: %s run done !", nexus()->getRequestId(), $action, $id, $force);
$this->info($log);
do_log($log);
return 0;
}
}

View File

@@ -14,15 +14,18 @@ use App\Models\HitAndRun;
use App\Models\Medal;
use App\Models\Peer;
use App\Models\SearchBox;
use App\Models\Setting;
use App\Models\Snatch;
use App\Models\Tag;
use App\Models\Torrent;
use App\Models\TorrentOperationLog;
use App\Models\User;
use App\Models\UserBanLog;
use App\Repositories\AgentAllowRepository;
use App\Repositories\AttendanceRepository;
use App\Repositories\ExamRepository;
use App\Repositories\HitAndRunRepository;
use App\Repositories\PluginRepository;
use App\Repositories\SearchBoxRepository;
use App\Repositories\SearchRepository;
use App\Repositories\TagRepository;
@@ -87,8 +90,7 @@ class Test extends Command
*/
public function handle()
{
$rep = new SearchBoxRepository();
$rep->migrateToModeRelated();
}

View File

@@ -35,6 +35,8 @@ class Kernel extends ConsoleKernel
$schedule->command('claim:settle')->hourly()->when(function () {
return Carbon::now()->format('d') == '01';
})->withoutOverlapping();
// $schedule->command('plugin:cronjob')->everyMinute()->withoutOverlapping();
}
/**