0 ' .'GROUP BY m.`id` ' .'HAVING `checked` = 1 ' .'ORDER BY RAND() LIMIT %d;'; // $query = 'SELECT `id` FROM `mountpoint` ORDER BY RAND() LIMIT %d;'; $query_opus = sprintf($query, ID_OPUS ,MAX_STREAMS_OPUS); $data_opus = $db->selectQuery($query_opus); $query_good = sprintf($query, ID_GOOD, MAX_STREAMS_GOOD); $data_good = $db->selectQuery($query_good); $query_bad = sprintf($query, ID_BAD, MAX_STREAMS_BAD); $data_bad = $db->selectQuery($query_bad); $res = array(); while (!$data_opus->endOf()) { $res[] = intval($data_opus->current('id')); $data_opus->next(); } while (!$data_good->endOf()) { $res[] = intval($data_good->current('id')); $data_good->next(); } while (!$data_bad->endOf()) { $res[] = intval($data_bad->current('id')); $data_bad->next(); } $data = $res; } catch (SQLNoResultException $e) { $data = array(); } // array_slice($data, 0, MAX_STREAMS_ON_HOMEPAGE) genfile::write(genfile::makeGenfileName('home_top'), $data) or die("Unable to save data in a genfile.\n"); echo("OK.\n"); ?>