mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
promotion info do not inject to torrent object
This commit is contained in:
@@ -158,16 +158,7 @@ class Torrent extends NexusModel
|
||||
}
|
||||
$spState = $this->sp_state;
|
||||
$global = self::getGlobalPromotionState();
|
||||
$log = sprintf('torrent: %s original sp_state: %s, original global_sp_state: %s', $this->id, $spState, $global);
|
||||
if ($this->__sticky_promotion) {
|
||||
//Cover original sp_state
|
||||
$spState = $this->__sticky_promotion['promotion_type'];
|
||||
$log .= "[SP_STATE_CHANGE] to __sticky_promotion: $spState]";
|
||||
}
|
||||
if ($this->__ignore_global_sp_state) {
|
||||
$global = self::PROMOTION_NORMAL;
|
||||
$log .= "[IGNORE_GLOBAL_SP_STATE], reset to: $global";
|
||||
}
|
||||
$log = sprintf('torrent: %s sp_state: %s, global sp state: %s', $this->id, $spState, $global);
|
||||
if ($global != self::PROMOTION_NORMAL) {
|
||||
$spState = $global;
|
||||
$log .= sprintf(", global != %s, set sp_state to global: %s", self::PROMOTION_NORMAL, $global);
|
||||
|
||||
@@ -385,7 +385,7 @@ class TrackerRepository extends BaseRepository
|
||||
if ($torrent->banned == 'yes' && $user->class < Setting::get('authority.seebanned')) {
|
||||
throw new TrackerException("torrent banned");
|
||||
}
|
||||
return apply_filter('torrent_detail', $torrent);
|
||||
return $torrent;
|
||||
}
|
||||
|
||||
protected function checkPeer(Torrent $torrent, array $queries, User $user): void
|
||||
@@ -677,6 +677,12 @@ class TrackerRepository extends BaseRepository
|
||||
$realDownloaded = max(bcsub($queries['downloaded'], $peer->downloaded), 0);
|
||||
$log .= ", [PEER_EXISTS], realUploaded: $realUploaded, realDownloaded: $realDownloaded";
|
||||
$spStateReal = $torrent->spStateReal;
|
||||
$log .= "[SP_STATE_REAL]: $spStateReal";
|
||||
$promotionInfo = apply_filter('torrent_promotion', $torrent->toArray());
|
||||
if ($promotionInfo) {
|
||||
$spStateReal = $promotionInfo['sp_state'];
|
||||
$log .= "[CHANGE_SP_STATE_BY_FILTER_TORRENT_PROMOTION]: $spStateReal";
|
||||
}
|
||||
$uploaderRatio = Setting::get('torrent.uploaderdouble');
|
||||
$log .= ", spStateReal: $spStateReal, uploaderRatio: $uploaderRatio";
|
||||
if ($torrent->owner == $user->id) {
|
||||
|
||||
Reference in New Issue
Block a user