]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix catchup of fresh feed
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 1 Oct 2007 03:26:06 +0000 (04:26 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 1 Oct 2007 03:26:06 +0000 (04:26 +0100)
functions.php

index a3235899714a2720abe80e01de3b0f575b647b20..45c59d37efca7544550a3a0181983ef53b3df2f6 100644 (file)
                                                $intl = get_pref($link, "FRESH_ARTICLE_MAX_AGE");
 
                                                if (DB_TYPE == "pgsql") {
-                                                       $match_part .= " AND date_entered > NOW() - INTERVAL '$intl hour' "; 
+                                                       $match_part = "date_entered > NOW() - INTERVAL '$intl hour' "; 
                                                } else {
-                                                       $match_part .= " AND date_entered > DATE_SUB(NOW(), 
+                                                       $match_part = "date_entered > DATE_SUB(NOW(), 
                                                                INTERVAL $intl HOUR) ";
                                                }
 
-                                               db_query($link, "UPDATE ttrss_user_entries 
-                                                       SET unread = false,last_read = NOW()
-                                                       WHERE $match_part AND owner_uid = ".$_SESSION["uid"]);
+                                               $result = db_query($link, "SELECT id FROM ttrss_entries, 
+                                                       ttrss_user_entries WHERE $match_part AND
+                                                       unread = true AND
+                                                       ttrss_user_entries.ref_id = ttrss_entries.id AND        
+                                                       owner_uid = ".$_SESSION["uid"]);
+
+                                               $affected_ids = array();
+
+                                               while ($line = db_fetch_assoc($result)) {
+                                                       array_push($affected_ids, $line["id"]);
+                                               }
+
+                                               catchupArticlesById($link, $affected_ids, 0);
                                        }
 
                                } else if ($feed < -10) { // label