ccache: remove obsolete data on feed/category removal

master
Andrew Dolgov 16 years ago
parent dee887d102
commit f6fed1b26b

@ -5754,6 +5754,19 @@
value = 0 WHERE owner_uid = '$owner_uid'"); value = 0 WHERE owner_uid = '$owner_uid'");
} }
function ccache_remove($link, $feed_id, $owner_uid, $is_cat = false) {
if (!$is_cat) {
$table = "ttrss_counters_cache";
} else {
$table = "ttrss_cat_counters_cache";
}
db_query($link, "DELETE FROM $table WHERE
feed_id = '$feed_id' AND owner_uid = '$owner_uid'");
}
function ccache_update_all($link, $owner_uid) { function ccache_update_all($link, $owner_uid) {
if (get_pref($link, 'ENABLE_FEED_CATS', $owner_uid)) { if (get_pref($link, 'ENABLE_FEED_CATS', $owner_uid)) {

@ -702,8 +702,12 @@
if (file_exists($icons_dir . "/$id.ico")) { if (file_exists($icons_dir . "/$id.ico")) {
unlink($icons_dir . "/$id.ico"); unlink($icons_dir . "/$id.ico");
} }
ccache_remove($link, $id, $_SESSION["uid"]);
} else { } else {
label_remove($link, -11-$id, $_SESSION["uid"]); label_remove($link, -11-$id, $_SESSION["uid"]);
ccache_remove($link, -11-$id, $_SESSION["uid"]);
} }
} }
} }
@ -992,6 +996,9 @@
if ($num_feeds == 0) { if ($num_feeds == 0) {
db_query($link, "DELETE FROM ttrss_feed_categories db_query($link, "DELETE FROM ttrss_feed_categories
WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]);
ccache_remove($link, $id, $_SESSION["uid"], true);
} else { } else {
print format_warning(__("Unable to delete non empty feed categories.")); print format_warning(__("Unable to delete non empty feed categories."));

Loading…
Cancel
Save