From: Andrew Dolgov Date: Fri, 22 Mar 2013 06:24:30 +0000 (+0400) Subject: remove obsolete entries from ccache on login X-Git-Tag: 1.7.5~25 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b1b1d25f50f6d4df0cea2aaf20f08944563d6e58;p=tt-rss.git remove obsolete entries from ccache on login --- diff --git a/include/functions.php b/include/functions.php index 238ba012..355fcd32 100644 --- a/include/functions.php +++ b/include/functions.php @@ -778,7 +778,21 @@ if ($_SESSION["uid"]) { cache_prefs($link); load_user_plugins($link, $_SESSION["uid"]); + + /* cleanup ccache */ + + db_query($link, "DELETE FROM ttrss_counters_cache WHERE owner_uid = ". + $_SESSION["uid"] . " AND + (SELECT COUNT(id) FROM ttrss_feeds WHERE + ttrss_feeds.id = feed_id) = 0"); + + db_query($link, "DELETE FROM ttrss_cat_counters_cache WHERE owner_uid = ". + $_SESSION["uid"] . " AND + (SELECT COUNT(id) FROM ttrss_feed_categories WHERE + ttrss_feed_categories.id = feed_id) = 0"); + } + } }