Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/php8' into php8
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Sep 14, 2023
2 parents 39446ae + 4f919f6 commit bc362bd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions public/announce.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,15 @@
if ($includeHr) {
$hrMode = \App\Models\HitAndRun::getConfig('mode', $torrent['mode']);
if ($hrMode == \App\Models\HitAndRun::MODE_GLOBAL || ($hrMode == \App\Models\HitAndRun::MODE_MANUAL && $torrent['hr'] == \App\Models\Torrent::HR_YES)) {
$sql = "insert into hit_and_runs (uid, torrent_id, snatched_id) values ($userid, $torrentid, {$snatchInfo['id']}) on duplicate key update updated_at = " . sqlesc(date('Y-m-d H:i:s'));
$affectedRows = sql_query($sql);
do_log("[INSERT_H&R], $sql, affectedRows: $affectedRows");
$hrCacheKey = sprintf("hit_and_run:%d:%d", $userid, $torrentid);
$hrExists = \Nexus\Database\NexusDB::remember($hrCacheKey, 24*3600, function () use ($snatchInfo) {
return \App\Models\HitAndRun::query()->where("snatched_id", $snatchInfo['id'])->exists();
});
if (!$hrExists) {
$sql = "insert into hit_and_runs (uid, torrent_id, snatched_id) values ($userid, $torrentid, {$snatchInfo['id']}) on duplicate key update updated_at = " . sqlesc(date('Y-m-d H:i:s'));
$affectedRows = sql_query($sql);
do_log("[INSERT_H&R], $sql, affectedRows: $affectedRows");
}
}
}
}
Expand Down

0 comments on commit bc362bd

Please sign in to comment.