From f3d4bae32eae802c717ff36fcaad1f7ee56d2a39 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 26 Feb 2021 09:57:34 +0300 Subject: add an option to disable DISTINCT on headlines query (unless it's Labels category) --- classes/feeds.php | 5 +++++ classes/pref/prefs.php | 4 +++- classes/prefs.php | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/classes/feeds.php b/classes/feeds.php index 7ea9ca474..5423fc617 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -1621,6 +1621,11 @@ class Feeds extends Handler_Protected { $distinct_qpart = "DISTINCT"; //fallback } + // except for Labels category + if (get_pref(Prefs::HEADLINES_NO_DISTINCT) && !($feed == -2 && $cat_view)) { + $distinct_qpart = ""; + } + if (!$search && !$skip_first_id_check) { // if previous topmost article id changed that means our current pagination is no longer valid $query = "SELECT diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index f24847c61..45926981f 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -63,6 +63,7 @@ class Pref_Prefs extends Handler_Protected { Prefs::SHORT_DATE_FORMAT, 'BLOCK_SEPARATOR', Prefs::SSL_CERT_SERIAL, + Prefs::HEADLINES_NO_DISTINCT, ] ]; @@ -97,7 +98,8 @@ class Pref_Prefs extends Handler_Protected { Prefs::USER_TIMEZONE => array(__("Time zone")), Prefs::VFEED_GROUP_BY_FEED => array(__("Group by feed"), __("Group multiple-feed output by originating feed")), Prefs::USER_LANGUAGE => array(__("Language")), - Prefs::USER_CSS_THEME => array(__("Theme")) + Prefs::USER_CSS_THEME => array(__("Theme")), + Prefs::HEADLINES_NO_DISTINCT => array(__("Don't enforce DISTINCT headlines"), __("May produce duplicate entries")), ]; // hidden in the main prefs UI (use to hide things that have description set above) diff --git a/classes/prefs.php b/classes/prefs.php index e6d8a84f1..6da1029dc 100644 --- a/classes/prefs.php +++ b/classes/prefs.php @@ -56,6 +56,7 @@ class Prefs { const USER_LANGUAGE = "USER_LANGUAGE"; const DEFAULT_SEARCH_LANGUAGE = "DEFAULT_SEARCH_LANGUAGE"; const _PREFS_MIGRATED = "_PREFS_MIGRATED"; + const HEADLINES_NO_DISTINCT = "HEADLINES_NO_DISTINCT"; private const _DEFAULTS = [ Prefs::PURGE_OLD_DAYS => [ 60, Config::T_INT ], @@ -112,6 +113,7 @@ class Prefs { Prefs::USER_LANGUAGE => [ "" , Config::T_STRING ], Prefs::DEFAULT_SEARCH_LANGUAGE => [ "" , Config::T_STRING ], Prefs::_PREFS_MIGRATED => [ false, Config::T_BOOL ], + Prefs::HEADLINES_NO_DISTINCT => [ false, Config::T_BOOL ], ]; const _PROFILE_BLACKLIST = [ -- cgit v1.2.3