Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
fix: announce.php
Browse files Browse the repository at this point in the history
  • Loading branch information
darkalchemy committed Oct 10, 2018
1 parent 7026283 commit cada597
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
10 Oct, 2018
fix: announce.php

02 Sept, 2018
update: database files
remove: image proxy key
Expand Down
72 changes: 36 additions & 36 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion include/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$params = [];
$query = str_replace(' ?', ' %s', $BaseQuery->getQuery(true));
$paramaters = $BaseQuery->getParameters();
$time = $BaseQuery->getTime();
$time = $BaseQuery->getExecutionTime();
if (!empty($paramaters) && count($paramaters) >= 1) {
foreach ($paramaters as $param) {
if (is_int($param)) {
Expand Down
11 changes: 6 additions & 5 deletions public/announce.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,8 @@
->select('last_action AS ts')
->select('UNIX_TIMESTAMP(NOW()) AS nowts')
->select('prev_action AS prevts')
->where('(peer_id = ? OR peer_id = ?)', $peer_id, preg_replace('/ *$/s', '', $peer_id))
->where(['peer_id = ?' => $peer_id, 'peer_id = ?' => preg_replace('/ *$/s', '', $peer_id)])
->where('torrent = ?', $torrentid)
->where('(peer_id = ? OR peer_id = ?)', $peer_id, preg_replace('/ *$/s', '', $peer_id))
->fetch();

if ($row) {
Expand Down Expand Up @@ -425,7 +424,7 @@
$seeder = 'no';
$delete_count = $fluent->deleteFrom('peers')
->where('torrent = ?', $torrentid)
->where('(peer_id = ? OR peer_id = ?)', $peer_id, preg_replace('/ *$/s', '', $peer_id))
->where(['peer_id = ?' => $peer_id, 'peer_id = ?' => preg_replace('/ *$/s', '', $peer_id)])
->execute();

$cache->delete('peers_' . $userid);
Expand Down Expand Up @@ -538,7 +537,7 @@
$updated = $fluent->update('peers')
->set($set)
->where('torrent = ?', $torrentid)
->where('(peer_id = ? OR peer_id = ?)', $peer_id, preg_replace('/ *$/s', '', $peer_id))
->where(['peer_id = ?' => $peer_id, 'peer_id = ?' => preg_replace('/ *$/s', '', $peer_id)])
->execute();

$cache->delete('peers_' . $userid);
Expand Down Expand Up @@ -616,10 +615,11 @@
->ignore()
->execute();

echo $insert_peers;
if ($insert_peers == 0) {
$fluent->update('peers')
->set($update_values)
->where('peer_id = ?', $peer_id)
->where('ip = ?', inet_pton($realip))
->execute();
} else {
if ($seeder == 'yes') {
Expand Down Expand Up @@ -664,6 +664,7 @@
->execute();
}
if (!empty($snatch_updateset)) {
file_put_contents('/var/log/nginx/announce.log', json_encode($snatch_updateset) . PHP_EOL, FILE_APPEND);
$fluent->update('snatched')
->set($snatch_updateset)
->where('torrentid = ?', $torrentid)
Expand Down

0 comments on commit cada597

Please sign in to comment.