api: updateArticle: update ccache when necessary

This commit is contained in:
Andrew Dolgov 2010-11-07 11:17:20 +03:00
parent 736e8977b3
commit b4fdbcf4b7
1 changed files with 16 additions and 1 deletions

View File

@ -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;