]> git.wh0rd.org Git - tt-rss.git/commitdiff
queryFeedHeadlines: don't check first_id when sorting by oldest first
authorAndrew Dolgov <noreply@fakecake.org>
Sat, 21 Nov 2015 19:20:00 +0000 (22:20 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sat, 21 Nov 2015 19:20:00 +0000 (22:20 +0300)
classes/api.php [changed mode: 0644->0755]
classes/feeds.php [changed mode: 0644->0755]
include/functions2.php

old mode 100644 (file)
new mode 100755 (executable)
index 08c1846..dfe9ef6
@@ -210,6 +210,8 @@ class API extends Handler {
 
                        $_SESSION['hasSandbox'] = $has_sandbox;
 
+                       $skip_first_id_check = false;
+
                        $override_order = false;
                        switch ($_REQUEST["order_by"]) {
                                case "title":
@@ -217,6 +219,7 @@ class API extends Handler {
                                        break;
                                case "date_reverse":
                                        $override_order = "score DESC, date_entered, updated";
+                                       $skip_first_id_check = true;
                                        break;
                                case "feed_dates":
                                        $override_order = "updated DESC";
@@ -230,7 +233,7 @@ class API extends Handler {
                        list($headlines, $headlines_header) = $this->api_get_headlines($feed_id, $limit, $offset,
                                $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $override_order,
                                $include_attachments, $since_id, $search,
-                               $include_nested, $sanitize_content, $force_update, $excerpt_length, $check_first_id);
+                               $include_nested, $sanitize_content, $force_update, $excerpt_length, $check_first_id, $skip_first_id_check);
 
                        if ($include_header) {
                                $this->wrap(self::STATUS_OK, array($headlines_header, $headlines));
@@ -644,7 +647,7 @@ class API extends Handler {
                                $filter, $is_cat, $show_excerpt, $show_content, $view_mode, $order,
                                $include_attachments, $since_id,
                                $search = "", $include_nested = false, $sanitize_content = true,
-                               $force_update = false, $excerpt_length = 100, $check_first_id = false) {
+                               $force_update = false, $excerpt_length = 100, $check_first_id = false, $skip_first_id_check = false) {
 
                        if ($force_update && $feed_id > 0 && is_numeric($feed_id)) {
                                // Update the feed if required with some basic flood control
@@ -686,7 +689,8 @@ class API extends Handler {
                                "offset" => $offset,
                                "since_id" => $since_id,
                                "include_children" => $include_nested,
-                               "check_first_id" => $check_first_id
+                               "check_first_id" => $check_first_id,
+                               "skip_first_id_check" => $skip_first_id_check
                        );
 
                        $qfh_ret = queryFeedHeadlines($params);
old mode 100644 (file)
new mode 100755 (executable)
index c3cb72d..07a1874
@@ -148,7 +148,8 @@ class Feeds extends Handler_Protected {
 
        private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
                                        $next_unread_feed, $offset, $vgr_last_feed = false,
-                                       $override_order = false, $include_children = false, $check_first_id = false) {
+                                       $override_order = false, $include_children = false, $check_first_id = false,
+                                       $skip_first_id_check = false) {
 
                $disable_cache = false;
 
@@ -252,7 +253,8 @@ class Feeds extends Handler_Protected {
                                "override_order" => $override_order,
                                "offset" => $offset,
                                "include_children" => $include_children,
-                               "check_first_id" => $check_first_id
+                               "check_first_id" => $check_first_id,
+                               "skip_first_id_check" => $skip_first_id_check
                        );
 
                        $qfh_ret = queryFeedHeadlines($params);
@@ -903,6 +905,7 @@ class Feeds extends Handler_Protected {
                $reply['headlines'] = array();
 
                $override_order = false;
+               $skip_first_id_check = false;
 
                switch ($order_by) {
                case "title":
@@ -910,6 +913,7 @@ class Feeds extends Handler_Protected {
                        break;
                case "date_reverse":
                        $override_order = "score DESC, date_entered, updated";
+                       $skip_first_id_check = true;
                        break;
                case "feed_dates":
                        $override_order = "updated DESC";
@@ -920,7 +924,7 @@ class Feeds extends Handler_Protected {
 
                $ret = $this->format_headlines_list($feed, $method,
                        $view_mode, $limit, $cat_view, $next_unread_feed, $offset,
-                       $vgroup_last_feed, $override_order, true, $check_first_id);
+                       $vgroup_last_feed, $override_order, true, $check_first_id, $skip_first_id_check);
 
                //$topmost_article_ids = $ret[0];
                $headlines_count = $ret[1];
index 779688716749c442a7588d7bb08e0bee99efe1ef..0386b52ed30443ac95f4278dffd51fb9756632c5 100755 (executable)
                $override_vfeed = isset($params["override_vfeed"]) ? $params["override_vfeed"] : false;
                $start_ts = isset($params["start_ts"]) ? $params["start_ts"] : false;
                $check_first_id = isset($params["check_first_id"]) ? $params["check_first_id"] : false;
+               $skip_first_id_check = isset($params["skip_first_id_check"]) ? $params["skip_first_id_check"] : false;
 
                $ext_tables_part = "";
                $query_strategy_part = "";
                                        $sanity_interval_qpart = "date_entered >= DATE_SUB(NOW(), INTERVAL 1 hour) AND";
                                }
 
-                               if (!$search) {
+                               if (!$search && !$skip_first_id_check) {
                                        // if previous topmost article id changed that means our current pagination is no longer valid
                                        $query = "SELECT DISTINCT
                                                        ttrss_feeds.title,