From 414d0d1f46d2be49e95cf668efec906fb989d1f2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 20 Apr 2011 15:36:46 +0400 Subject: [PATCH] implement feedbrowser using linked feeds; set proper fetch timeout --- functions.php | 2 +- modules/pref-feeds.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index e0c2a664..4980140c 100644 --- a/functions.php +++ b/functions.php @@ -7371,7 +7371,7 @@ $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"; } diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index f496c782..238ca0a8 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -1539,11 +1539,21 @@ } 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 -- 2.39.5