From: Andrew Dolgov Date: Sun, 7 Nov 2010 08:17:20 +0000 (+0300) Subject: api: updateArticle: update ccache when necessary X-Git-Tag: 1.5.0~387 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b4fdbcf4b7fbdd03a10f2bc26fd23c46341ffffb;p=tt-rss.git api: updateArticle: update ccache when necessary --- diff --git a/api/index.php b/api/index.php index 8e6b6111..b523da60 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;