From 70c8fb6c4f40294380dc4642e9ddfcb90d45baad Mon Sep 17 00:00:00 2001 From: Darko Date: Thu, 13 Aug 2015 12:58:36 +0200 Subject: [PATCH] Add the old 2014 query while the new one is not fixed. --- newznab/controllers/Enzebe.php | 4 ++-- newznab/controllers/Sharing.php | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/newznab/controllers/Enzebe.php b/newznab/controllers/Enzebe.php index 2d01d762b..68552fd42 100644 --- a/newznab/controllers/Enzebe.php +++ b/newznab/controllers/Enzebe.php @@ -214,8 +214,8 @@ class Enzebe $this->pdo->queryExec( sprintf(' UPDATE releases SET nzbstatus = %d %s WHERE id = %d', - \NZB::NZB_ADDED, - ($nzb_guid === '' ? '' : ', nzb_guid = ' . $this->pdo->escapestring(md5($nzb_guid))), + NZB::NZB_ADDED, + ($nzb_guid === '' ? '' : ', nzb_guid = UNHEX( ' . $this->pdo->escapestring(md5($nzb_guid)) . ' )'), $relID ) ); diff --git a/newznab/controllers/Sharing.php b/newznab/controllers/Sharing.php index 40c90cbbe..ace6ff3c7 100644 --- a/newznab/controllers/Sharing.php +++ b/newznab/controllers/Sharing.php @@ -323,15 +323,20 @@ Class Sharing } // Update first time seen. - $this->pdo->queryExec( - sprintf(" - UPDATE sharing_sites ss - INNER JOIN release_comments rc ON rc.siteid = ss.site_guid - SET ss.first_time = rc.createddate - WHERE rc.createddate > '2005-01-01' - " - ) + $siteTimes = $this->pdo->queryDirect( + 'SELECT createddate, siteid FROM release_comments WHERE createddate > \'2005-01-01\' GROUP BY siteid ORDER BY createddate ASC' ); + if ($siteTimes instanceof \Traversable && $siteTimes->rowCount()) { + foreach ($siteTimes as $site) { + $this->pdo->queryExec( + sprintf( + 'UPDATE sharing_sites SET first_time = %s WHERE site_guid = %s', + $this->pdo->escapeString($site['createddate']), + $this->pdo->escapeString($site['siteid']) + ) + ); + } + } } /**