From 68ca8951a85973cf385f23b6147f51718563d7bf Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 25 Nov 2022 18:37:22 +0000 Subject: mark unseen items seen after a certain amount of time (default 90 days) --- Zotlabs/Daemon/Cron_daily.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Zotlabs/Daemon/Cron_daily.php') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index d1b74a032..71d3bc9ef 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -49,6 +49,22 @@ class Cron_daily { dbesc('sse_id.%') ); + // Mark items seen after X days (default 90) + + $r = dbq("select channel_id from channel where channel_removed = 0"); + if ($r) { + foreach ($r as $rr) { + $mark_seen_days = get_pconfig($rr['channel_id'], 'system', 'mark_seen_days', 90); + q("UPDATE item SET item_unseen = 0 WHERE + uid = %d AND item_unseen = 1 + AND created < %s - INTERVAL %s", + intval($rr['channel_id']), + db_utcnow(), + db_quoteinterval($mark_seen_days . ' DAY') + ); + } + } + // Clean up emdedded content cache q("DELETE FROM cache WHERE updated < %s - INTERVAL %s", db_utcnow(), -- cgit v1.2.3