From 5c47c9ed9579dc97e0a508045fe50264bb96490b Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 25 Nov 2019 14:16:07 +0100 Subject: Add daily cached embedded content cleanup --- Zotlabs/Daemon/Cron_daily.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index b41625963..affb706a0 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -94,6 +94,12 @@ class Cron_daily { z6_discover(); call_hooks('cron_daily',datetime_convert()); + + // Clean up emdeded contect cache + q("DELETE FROM cache WHERE updated < %s - INTERVAL %s", + db_utcnow(), + db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY') + ); set_config('system','last_expire_day',intval(datetime_convert('UTC','UTC','now','d'))); -- cgit v1.2.3 From 38de059156f9a6ec63727d47a96d1b15e96e3b47 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 25 Nov 2019 14:32:58 +0100 Subject: Revert "Add daily cached embedded content cleanup" This reverts commit 5c47c9ed9579dc97e0a508045fe50264bb96490b --- Zotlabs/Daemon/Cron_daily.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index affb706a0..b41625963 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -94,12 +94,6 @@ class Cron_daily { z6_discover(); call_hooks('cron_daily',datetime_convert()); - - // Clean up emdeded contect cache - q("DELETE FROM cache WHERE updated < %s - INTERVAL %s", - db_utcnow(), - db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY') - ); set_config('system','last_expire_day',intval(datetime_convert('UTC','UTC','now','d'))); -- cgit v1.2.3 From 901785663edc7045c66d9393432a18bb376436bb Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Mon, 25 Nov 2019 21:50:02 +0100 Subject: Fix once cached embedded content is used and stored forever --- Zotlabs/Daemon/Cron_daily.php | 5 +++++ Zotlabs/Lib/Cache.php | 13 ++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index b41625963..452ef45f1 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -50,6 +50,11 @@ class Cron_daily { dbesc('sse_id.%') ); + // Clean up emdedded content cache + q("DELETE FROM cache WHERE updated < %s - INTERVAL %s", + db_utcnow(), + db_quoteinterval(get_config('system','active_expire_days', '30') . ' DAY') + ); //update statistics in config require_once('include/statistics_fns.php'); diff --git a/Zotlabs/Lib/Cache.php b/Zotlabs/Lib/Cache.php index cea075659..878201a42 100644 --- a/Zotlabs/Lib/Cache.php +++ b/Zotlabs/Lib/Cache.php @@ -11,8 +11,10 @@ class Cache { $hash = hash('whirlpool',$key); - $r = q("SELECT v FROM cache WHERE k = '%s' limit 1", - dbesc($hash) + $r = q("SELECT v FROM cache WHERE k = '%s' AND updated > %s - INTERVAL %s LIMIT 1", + dbesc($hash), + db_utcnow(), + db_quoteinterval(get_config('system','object_cache_days', '30') . ' DAY') ); if ($r) @@ -40,12 +42,5 @@ class Cache { dbesc(datetime_convert())); } } - - - public static function clear() { - q("DELETE FROM cache WHERE updated < '%s'", - dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); - } - } -- cgit v1.2.3