$instance_qpart = "";
if (DB_TYPE == "pgsql") {
- $date_qpart = "last_connected < NOW() - INTERVAL '1 second'";
+ $date_qpart = "last_connected < NOW() - INTERVAL '6 hours'";
} else {
$date_qpart = "last_connected < DATE_SUB(NOW(), INTERVAL 6 HOUR";
}
}
if ($mode == 1) {
- $result = db_query($link, "SELECT feed_url, subscribers FROM
+ /* $result = db_query($link, "SELECT feed_url, subscribers FROM
ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
AND owner_uid = '$owner_uid') $search_qpart
- ORDER BY subscribers DESC LIMIT $limit");
+ ORDER BY subscribers DESC LIMIT $limit"); */
+
+ $result = db_query($link, "SELECT feed_url, title, SUM(subscribers) AS subscribers FROM
+ (SELECT feed_url, title, subscribers FROM ttrss_feedbrowser_cache UNION ALL
+ SELECT feed_url, title, subscribers FROM ttrss_linked_feeds) AS qqq
+ WHERE
+ (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
+ WHERE tf.feed_url = qqq.feed_url
+ AND owner_uid = '$owner_uid') $search_qpart
+ GROUP BY feed_url, title ORDER BY subscribers DESC LIMIT $limit");
+
} else if ($mode == 2) {
$result = db_query($link, "SELECT *,
(SELECT COUNT(*) FROM ttrss_user_entries WHERE