]> git.wh0rd.org Git - tt-rss.git/commitdiff
api: updateArticle: update ccache when necessary
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 7 Nov 2010 08:17:20 +0000 (11:17 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 7 Nov 2010 08:18:41 +0000 (11:18 +0300)
api/index.php

index 8e6b61110179e685c9999b878ebdc21905b7a387..b523da60556f66f8fa67ba6b540879e561e7cee3 100644 (file)
                                                WHERE ref_id IN ($article_ids) AND owner_uid = " . $_SESSION["uid"]);
                                }
 
-                               // FIXME: find out which feeds reference this article id and do ccache_update() on them
+                               $num_updated = db_affected_rows($link, $result);
+
+                               if ($num_updated > 0 && $field == "unread") {
+                                       $result = db_query($link, "SELECT DISTINCT feed_id FROM ttrss_user_entries
+                                               WHERE ref_id IN ($article_ids)");
+
+                                       while ($line = db_fetch_assoc($result)) {
+                                               ccache_update($link, $line["feed_id"], $_SESSION["uid"]);
+                                       }
+                               }
+
+                               print json_encode(array("status" => "OK", 
+                                       "updated" => $num_updated));
+
+                       } else {
+                               print json_encode(array("error" => 'INCORRECT_USAGE'));
                        }
 
                        break;