From b4fdbcf4b7fbdd03a10f2bc26fd23c46341ffffb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 7 Nov 2010 11:17:20 +0300 Subject: [PATCH] api: updateArticle: update ccache when necessary --- api/index.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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;