summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-11-07 11:17:20 +0300
committerAndrew Dolgov <[email protected]>2010-11-07 11:18:41 +0300
commitb4fdbcf4b7fbdd03a10f2bc26fd23c46341ffffb (patch)
tree6a37bde0c2a46c5fe3c85aeccf6f1a00f603bd4e /api
parent736e8977b3ca635fcb0f700814e41fba50a9eb84 (diff)
api: updateArticle: update ccache when necessary
Diffstat (limited to 'api')
-rw-r--r--api/index.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/api/index.php b/api/index.php
index 8e6b61110..b523da605 100644
--- a/api/index.php
+++ b/api/index.php
@@ -209,7 +209,22 @@
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;