queryFeedHeadlines: don't check first_id when sorting by oldest first

master
Andrew Dolgov 9 years ago
parent aa03bac424
commit 19e47ad60b

@ -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);

@ -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];

@ -465,6 +465,7 @@
$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 = "";
@ -731,7 +732,7 @@
$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,

Loading…
Cancel
Save