admin add torrents

This commit is contained in:
xiaomlove
2022-07-03 14:00:07 +08:00
parent 9cf1cc7277
commit bd11527f4b
26 changed files with 393 additions and 31 deletions

View File

@@ -12,14 +12,14 @@ class NexusUpdate extends Command
*
* @var string
*/
protected $signature = 'nexus:update {--tag=} {--keep_tmp}';
protected $signature = 'nexus:update {--tag=} {--keep_tmp} {--include_composer}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update nexusphp after code updated, remember run `composer update` first. Options: --tag=, --keep_tmp';
protected $description = 'Update nexusphp after code updated, remember run `composer update` first. Options: --tag=, --keep_tmp, --include_composer';
private $update;
@@ -45,14 +45,19 @@ class NexusUpdate extends Command
require ROOT_PATH . 'nexus/Database/helpers.php';
$tag = $this->option('tag');
$keepTmp = $this->option('keep_tmp');
$includeComposer = $this->option('include_composer');
$includes = [];
if ($includeComposer) {
$includes[] = 'composer';
}
if ($tag !== null) {
if ($tag === 'dev') {
$url = "https://github.com/xiaomlove/nexusphp/archive/refs/heads/php8.zip";
} else {
$url = "https://api.github.com/repos/xiaomlove/nexusphp/tarball/v$tag";
}
$this->doLog("Specific tag: '$tag', download from '$url' and extra code...");
$tmpPath = $this->update->downAndExtractCode($url);
$this->doLog("Specific tag: '$tag', download from '$url' and extra code, includes: " . implode(', ', $includes));
$tmpPath = $this->update->downAndExtractCode($url, $includes);
}
//Step 1
$step = $this->update->currentStep();

View File

@@ -78,8 +78,8 @@ class Test extends Command
*/
public function handle()
{
$r = User::query()->find(10003, ['id', 'added', 'donoruntil']);
dd($r->donoruntil->toDateTimeString() < '1978');
$r = Carbon::parse('2022-07-03 04:00:00')->diffInSeconds();
dd($r);
}