mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 04:20:49 +08:00
Merge branch 'php8' into section
This commit is contained in:
@@ -62,7 +62,12 @@ class HitAndRun extends NexusModel
|
||||
if ($this->status != self::STATUS_INSPECTING) {
|
||||
return '---';
|
||||
}
|
||||
$inspectTime = HitAndRun::getConfig('inspect_time', $this->torrent->basic_category->mode);
|
||||
$searchBoxId = $this->torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $this->torrent_id), 'error');
|
||||
return '---';
|
||||
}
|
||||
$inspectTime = HitAndRun::getConfig('inspect_time', $searchBoxId);
|
||||
$diffInSeconds = Carbon::now()->diffInSeconds($this->snatch->completedat->addHours($inspectTime));
|
||||
return mkprettytime($diffInSeconds);
|
||||
}
|
||||
@@ -72,7 +77,12 @@ class HitAndRun extends NexusModel
|
||||
if ($this->status != self::STATUS_INSPECTING) {
|
||||
return '---';
|
||||
}
|
||||
$seedTimeMinimum = HitAndRun::getConfig('seed_time_minimum', $this->torrent->basic_category->mode);
|
||||
$searchBoxId = $this->torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $this->torrent_id), 'error');
|
||||
return '---';
|
||||
}
|
||||
$seedTimeMinimum = HitAndRun::getConfig('seed_time_minimum', $searchBoxId);
|
||||
$diffInSeconds = 3600 * $seedTimeMinimum - $this->snatch->seedtime;
|
||||
return mkprettytime($diffInSeconds);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,12 @@ class Torrent extends NexusModel
|
||||
public function getHrAttribute(): string
|
||||
{
|
||||
// $hrMode = Setting::get('hr.mode');
|
||||
$hrMode = HitAndRun::getConfig('mode', $this->basic_category->mode);
|
||||
$searchBoxId = $this->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s, category: %s invalid', $this->id, $this->category), 'error');
|
||||
return self::HR_NO;
|
||||
}
|
||||
$hrMode = HitAndRun::getConfig('mode', $searchBoxId);
|
||||
if ($hrMode == HitAndRun::MODE_GLOBAL) {
|
||||
return self::HR_YES;
|
||||
}
|
||||
|
||||
@@ -301,8 +301,12 @@ class SearchRepository extends BaseRepository
|
||||
$idName => $this->getTorrentId($torrent->id),
|
||||
'routing' => $torrent->owner,
|
||||
];
|
||||
$searchBoxId = $torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $torrent->id), 'error');
|
||||
}
|
||||
$data = Arr::only($torrent->toArray(), $baseFields);
|
||||
$data['mode'] = $torrent->basic_category->mode;
|
||||
$data['mode'] = $searchBoxId;
|
||||
$body = array_merge($data, [
|
||||
'_doc_type' => $docType,
|
||||
'torrent_id' => $torrent->id,
|
||||
|
||||
@@ -1093,7 +1093,12 @@ class TrackerRepository extends BaseRepository
|
||||
return;
|
||||
}
|
||||
// $hrMode = Setting::get('hr.mode');
|
||||
$hrMode = HitAndRun::getConfig('mode', $torrent->basic_category->mode);
|
||||
$searchBoxId = $torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log(sprintf('[INVALID_CATEGORY], Torrent: %s', $torrent->id), 'error');
|
||||
return;
|
||||
}
|
||||
$hrMode = HitAndRun::getConfig('mode', $searchBoxId);
|
||||
if ($hrMode == HitAndRun::MODE_DISABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.30');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-10-29');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-11-05');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
@@ -5742,7 +5742,12 @@ function can_access_torrent($torrent)
|
||||
if (is_array($torrent) && isset($torrent['search_box_id'])) {
|
||||
$searchBoxId = $torrent['search_box_id'];
|
||||
} elseif (is_numeric($torrent)) {
|
||||
$searchBoxId = \App\Models\Torrent::query()->findOrFail(intval($torrent), ['id', 'category'])->basic_category->mode;
|
||||
$torrent = \App\Models\Torrent::query()->findOrFail(intval($torrent), ['id', 'category']);
|
||||
$searchBoxId = $torrent->basic_category->mode ?? 0;
|
||||
if ($searchBoxId == 0) {
|
||||
do_log("[INVALID_CATEGORY], torrent: " . $torrent->id, 'error');
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Unsupported argument: " . json_encode($torrent));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user