summaryrefslogtreecommitdiff
path: root/classes/feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-26 15:45:30 +0300
committerAndrew Dolgov <[email protected]>2021-02-26 15:45:30 +0300
commitd577eb898cb8bab1386cb2842280e52792863f9b (patch)
treef7b44dce94b2da9075bc6e14c33e105a50f607cf /classes/feeds.php
parentc01b6e43fd5236ab8fe504bf355184bf6dd4734b (diff)
when browsing by tags, return same set of columns as normally
Diffstat (limited to 'classes/feeds.php')
-rwxr-xr-xclasses/feeds.php50
1 files changed, 29 insertions, 21 deletions
diff --git a/classes/feeds.php b/classes/feeds.php
index c35517ecb..583cb3e12 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -1574,6 +1574,12 @@ class Feeds extends Handler_Protected {
$first_id = 0;
+ if (Config::get(Config::DB_TYPE) == "pgsql") {
+ $yyiw_qpart = "to_char(date_entered, 'IYYY-IW') AS yyiw";
+ } else {
+ $yyiw_qpart = "date_format(date_entered, '%Y-%u') AS yyiw";
+ }
+
if (is_numeric($feed)) {
// proper override_order applied above
if ($vfeed_query_part && !$ignore_vfeed_group && get_pref(Prefs::VFEED_GROUP_BY_FEED, $owner_uid)) {
@@ -1611,13 +1617,11 @@ class Feeds extends Handler_Protected {
if (Config::get(Config::DB_TYPE) == "pgsql") {
$sanity_interval_qpart = "date_entered >= NOW() - INTERVAL '1 hour' AND";
- $yyiw_qpart = "to_char(date_entered, 'IYYY-IW') AS yyiw";
$distinct_columns = str_replace("desc", "", strtolower($order_by));
$distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
} else {
$sanity_interval_qpart = "date_entered >= DATE_SUB(NOW(), INTERVAL 1 hour) AND";
- $yyiw_qpart = "date_format(date_entered, '%Y-%u') AS yyiw";
$distinct_qpart = "DISTINCT"; //fallback
}
@@ -1715,41 +1719,45 @@ class Feeds extends Handler_Protected {
} else {
// browsing by tag
- if (Config::get(Config::DB_TYPE) == "pgsql") {
- $distinct_columns = str_replace("desc", "", strtolower($order_by));
- $distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
+ if (get_pref(Prefs::HEADLINES_NO_DISTINCT, $owner_uid)) {
+ $distinct_qpart = "";
} else {
- $distinct_qpart = "DISTINCT"; //fallback
+ if (Config::get(Config::DB_TYPE) == "pgsql") {
+ $distinct_columns = str_replace("desc", "", strtolower($order_by));
+ $distinct_qpart = "DISTINCT ON (id, $distinct_columns)";
+ } else {
+ $distinct_qpart = "DISTINCT"; //fallback
+ }
}
$query = "SELECT $distinct_qpart
+ ttrss_entries.id AS id,
date_entered,
+ $yyiw_qpart,
guid,
- note,
- ttrss_entries.id as id,
- title,
+ ttrss_entries.title,
updated,
- unread,
- feed_id,
- marked,
- published,
+ label_cache,
+ tag_cache,
+ always_display_enclosures,
+ site_url,
+ note,
num_comments,
comments,
int_id,
- tag_cache,
- label_cache,
- link,
- lang,
uuid,
- last_read,
- (SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images,
+ lang,
+ hide_images,
+ unread,feed_id,marked,published,link,last_read,
last_marked, last_published,
$since_id_part
$vfeed_query_part
$content_query_part
- author, score
- FROM ttrss_entries, ttrss_user_entries, ttrss_tags
+ author, score,
+ (SELECT count(id) FROM ttrss_enclosures WHERE post_id = ttrss_entries.id) AS num_enclosures
+ FROM ttrss_entries, ttrss_user_entries, ttrss_tags, ttrss_feeds
WHERE
+ ttrss_feeds.id = ttrss_user_entries.feed_id AND
ref_id = ttrss_entries.id AND
ttrss_user_entries.owner_uid = ".$pdo->quote($owner_uid)." AND
post_int_id = int_id AND