summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-08-05 14:16:06 +0400
committerAndrew Dolgov <[email protected]>2011-08-05 14:16:06 +0400
commit3261ca582066ea7f88e1a7745e4e8ccdf83056ab (patch)
treec4da1cdebcd222e6d94fdbbbcdd378c5b157b4d4 /functions.php
parent3205fab020cdd6bec0add3aa4b879edc536b720a (diff)
add ccache_cleanup(), invoke on login
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index 7cd509ae7..0c5819656 100644
--- a/functions.php
+++ b/functions.php
@@ -2149,6 +2149,9 @@
setcookie("ttrss_lang", $_SESSION["language"],
time() + SESSION_COOKIE_LIFETIME);
}
+
+ // try to remove possible duplicates from feed counter cache
+ ccache_cleanup($link, $_SESSION["uid"]);
}
} else {
@@ -6120,6 +6123,19 @@
return $unread;
}
+ function ccache_cleanup($link, $owner_uid) {
+
+ db_query($link, "DELETE FROM ttrss_counters_cache AS c1 WHERE
+ (SELECT count(*) FROM ttrss_counters_cache AS c2
+ WHERE c1.feed_id = c2.feed_id AND c2.owner_uid = c1.owner_uid) > 1
+ AND owner_uid = '$owner_uid'");
+
+ db_query($link, "DELETE FROM ttrss_cat_counters_cache AS c1 WHERE
+ (SELECT count(*) FROM ttrss_cat_counters_cache AS c2
+ WHERE c1.feed_id = c2.feed_id AND c2.owner_uid = c1.owner_uid) > 1
+ AND owner_uid = '$owner_uid'");
+ }
+
function label_find_id($link, $label, $owner_uid) {
$result = db_query($link,
"SELECT id FROM ttrss_labels2 WHERE caption = '$label'