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. //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) { 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); $Found = $NotFound = array_fill_keys($RequestIDs, false);
// Try to fetch the requests from the cache first. // 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"); $Data = G::$Cache->get_value("request_$RequestID");
if (!empty($Data)) { if (!empty($Data)) {
unset($NotFound[$RequestID]); unset($NotFound[$RequestID]);
$Found[$RequestID] = $Data; $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)); $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) { 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); $Found = $NotFound = array_fill_keys($GroupIDs, false);
$Key = $Torrents ? 'torrent_group_' : 'torrent_group_light_'; $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); $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]); unset($NotFound[$GroupID]);
$Found[$GroupID] = $Data['d']; $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)); $IDs = implode(',', array_keys($NotFound));
/* /*