Empty commit

This commit is contained in:
Git 2013-10-04 08:00:56 +00:00
parent 5951e1ac20
commit 01838408b8
2 changed files with 19 additions and 16 deletions

View File

@ -53,21 +53,23 @@ public static function update_sphinx_requests($RequestID) {
//
//In places where the output from this is merged with sphinx filters, it will be in a different order.
public static function get_requests($RequestIDs, $Return = true) {
// Make sure there's something in $RequestIDs, otherwise the SQL will break
if (count($RequestIDs) === 0) {
return array();
}
$Found = $NotFound = array_fill_keys($RequestIDs, false);
// Try to fetch the requests from the cache first.
foreach ($RequestIDs as $RequestID) {
foreach ($RequestIDs as $i => $RequestID) {
if (!is_number($RequestID)) {
unset($RequestIDs[$i], $Found[$GroupID], $NotFound[$GroupID]);
continue;
}
$Data = G::$Cache->get_value("request_$RequestID");
if (!empty($Data)) {
unset($NotFound[$RequestID]);
$Found[$RequestID] = $Data;
}
}
// Make sure there's something in $RequestIDs, otherwise the SQL will break
if (count($RequestIDs) === 0) {
return array();
}
$IDs = implode(',', array_keys($NotFound));
/*

View File

@ -46,23 +46,24 @@ class Torrents {
* }
*/
public static function get_groups($GroupIDs, $Return = true, $GetArtists = true, $Torrents = true) {
// Make sure there's something in $GroupIDs, otherwise the SQL
// will break
if (count($GroupIDs) == 0) {
return array();
}
$Found = $NotFound = array_fill_keys($GroupIDs, false);
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_';
foreach ($GroupIDs as $GroupID) {
foreach ($GroupIDs as $i => $GroupID) {
if (!is_number($GroupID)) {
unset($GroupIDs[$i], $Found[$GroupID], $NotFound[$GroupID]);
continue;
}
$Data = G::$Cache->get_value($Key.$GroupID, true);
if (!empty($Data) && (@$Data['ver'] == CACHE::GROUP_VERSION)) {
if (!empty($Data) && $Data['ver'] == CACHE::GROUP_VERSION) {
unset($NotFound[$GroupID]);
$Found[$GroupID] = $Data['d'];
}
}
// Make sure there's something in $GroupIDs, otherwise the SQL will break
if (count($GroupIDs) === 0) {
return array();
}
$IDs = implode(',', array_keys($NotFound));
/*