diff --git a/gazelle.sql b/gazelle.sql index e9aace3b..7697c558 100644 --- a/gazelle.sql +++ b/gazelle.sql @@ -1447,10 +1447,13 @@ CREATE TABLE `xbt_files_users` ( `ipa` int(12) unsigned NOT NULL, `mtime` int(11) NOT NULL, `ip` varchar(15) NOT NULL DEFAULT '', - PRIMARY KEY (`uid`,`fid`,`peer_id`), + PRIMARY KEY (`peer_id`,`fid`), KEY `remaining_idx` (`remaining`), KEY `fid_idx` (`fid`), - KEY `mtime_idx` (`mtime`) + KEY `mtime_idx` (`mtime`), + KEY `uid` (`uid`), + KEY `downloaded` (`downloaded`), + KEY `active` (`active`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `xbt_scrape_log` ( diff --git a/sections/torrents/download.php b/sections/torrents/download.php index 0e454cda..c1b7e2aa 100644 --- a/sections/torrents/download.php +++ b/sections/torrents/download.php @@ -110,6 +110,10 @@ ON DUPLICATE KEY UPDATE Time=VALUES(Time), Expired=FALSE"); $DB->query("UPDATE users_main SET FLTokens = FLTokens - 1 WHERE ID=$UserID"); + // Fix for downloadthemall messing with the cached token count + $UInfo = user_heavy_info($UserID); + $FLTokens = $UInfo['FLTokens']; + $Cache->begin_transaction('user_info_heavy_'.$UserID); $Cache->update_row(false, array('FLTokens'=>($FLTokens - 1))); $Cache->commit_transaction(0);