]> git.wh0rd.org Git - tt-rss.git/commitdiff
return feed update error msg in getFeedCounters()
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 16 Dec 2005 16:51:39 +0000 (17:51 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 16 Dec 2005 16:51:39 +0000 (17:51 +0100)
backend.php

index 50d04e6b4a46c93c0cbbc5f01eb34a7d01390683..8652a1c4301359093c14b60c508181e9be046bf0 100644 (file)
        function getFeedCounter($link, $id) {
        
                $result = db_query($link, "SELECT 
-                               count(id) as count FROM ttrss_entries,ttrss_user_entries
+                               count(id) as count,last_error
+                       FROM ttrss_entries,ttrss_user_entries,ttrss_feeds
                        WHERE feed_id = '$id' AND unread = true
+                       AND ttrss_user_entries.feed_id = ttrss_feeds.id
                        AND ttrss_user_entries.ref_id = ttrss_entries.id");
        
                        $count = db_fetch_result($result, 0, "count");
+                       $last_error = db_fetch_result($result, 0, "last_error");
                        
-                       print "<counter type=\"feed\" id=\"$id\" counter=\"$count\"/>";         
+                       print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" error=\"$last_error\"/>";           
        }
 
        function getFeedCounters($link, $smart_mode = SMART_RPC_COUNTERS) {
 
                $old_counters = $_SESSION["fctr_last_value"];
 
-               $result = db_query($link, "SELECT id,
+               $result = db_query($link, "SELECT id,last_error,
                        (SELECT count(id) 
                                FROM ttrss_entries,ttrss_user_entries 
-                               WHERE feed_id = ttrss_feeds.id AND ttrss_user_entries.ref_id = ttrss_entries.id
+                               WHERE feed_id = ttrss_feeds.id AND 
+                                       ttrss_user_entries.ref_id = ttrss_entries.id
                                AND unread = true AND owner_uid = ".$_SESSION["uid"].") as count
                        FROM ttrss_feeds WHERE owner_uid = ".$_SESSION["uid"]);
 
                
                        $id = $line["id"];
                        $count = $line["count"];
+                       $last_error = $line["last_error"];      
 
                        if (!$smart_mode || $old_counters[$id] != $count) {
                                $old_counters[$id] = $count;
                                $fctrs_modified = true;
-                               print "<counter type=\"feed\" id=\"$id\" counter=\"$count\"/>";
+
+                               if ($last_error) {
+                                       $error_part = "error=\"$last_error\"";
+                               } else {
+                                       $error_part = "";
+                               }
+                               
+                               print "<counter type=\"feed\" id=\"$id\" counter=\"$count\" $error_part/>";
                        }
                }