summaryrefslogtreecommitdiff
path: root/classes/feeds.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2020-01-24 14:25:31 +0300
committerAndrew Dolgov <[email protected]>2020-01-24 14:25:31 +0300
commit6080cca9ca1de60a5d4a1ef06d4873eca07d9ef2 (patch)
tree3a59a6803fbb38067746895bfcb277d2db688e81 /classes/feeds.php
parenta6d314b753d7e79da06c733efd5a96caf9b5f562 (diff)
scrap counter cache system; rework counters to sum() booleans instead
Diffstat (limited to 'classes/feeds.php')
-rwxr-xr-xclasses/feeds.php24
1 files changed, 5 insertions, 19 deletions
diff --git a/classes/feeds.php b/classes/feeds.php
index 2f55664e1..2aa7333fd 100755
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -457,8 +457,6 @@ class Feeds extends Handler_Protected {
$sth = $this->pdo->prepare("UPDATE ttrss_user_entries SET
last_read = NOW(), unread = false WHERE unread = true AND owner_uid = ?");
$sth->execute([$_SESSION['uid']]);
-
- CCache::zero_all($_SESSION["uid"]);
}
function view() {
@@ -512,13 +510,6 @@ class Feeds extends Handler_Protected {
return;
}
- /* Updating a label ccache means recalculating all of the caches
- * so for performance reasons we don't do that here */
-
- if ($feed >= 0) {
- CCache::update($feed, $_SESSION["uid"], $cat_view);
- }
-
set_pref("_DEFAULT_VIEW_MODE", $view_mode);
set_pref("_DEFAULT_VIEW_ORDER_BY", $order_by);
@@ -1013,8 +1004,6 @@ class Feeds extends Handler_Protected {
}
- CCache::update($feed, $owner_uid, $cat_view);
-
} else { // tag
$sth = $pdo->prepare("UPDATE ttrss_user_entries
SET unread = false, last_read = NOW() WHERE ref_id IN
@@ -1381,12 +1370,14 @@ class Feeds extends Handler_Protected {
$pdo = Db::pdo();
- $sth = $pdo->prepare("SELECT SUM(value) AS c_id FROM ttrss_counters_cache
- WHERE owner_uid = ? AND feed_id > 0");
+ $sth = $pdo->prepare("SELECT SUM(CASE WHEN unread THEN 1 ELSE 0 END) AS count
+ FROM ttrss_user_entries ue
+ WHERE ue.owner_uid = ?");
+
$sth->execute([$user_id]);
$row = $sth->fetch();
- return $row["c_id"];
+ return $row["count"];
}
static function getCategoryTitle($cat_id) {
@@ -2116,9 +2107,6 @@ class Feeds extends Handler_Protected {
}
if ($purge_interval == -1 || !$purge_interval) {
- if ($owner_uid) {
- CCache::update($feed_id, $owner_uid);
- }
return;
}
@@ -2163,8 +2151,6 @@ class Feeds extends Handler_Protected {
$rows = $sth->rowCount();
- CCache::update($feed_id, $owner_uid);
-
Debug::log("Purged feed $feed_id ($purge_interval): deleted $rows articles");
return $rows;