From 9627c3e7c850b3532c3840910c0862f093cd8fb1 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 21 Sep 2023 06:14:24 +0000 Subject: store the actor cache date so we can easily invalidate it after a period of time --- Zotlabs/Lib/Activity.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index cc0ac547c..9b94c4d8d 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -142,6 +142,7 @@ class Activity { logger('returned: ' . json_encode($y, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOGGER_DEBUG); if (isset($y['type']) && ActivityStreams::is_an_actor($y['type'])) { + $y['actor_cache_date'] = datetime_convert(); XConfig::Set($y['id'], 'system', 'actor_record', $y); } @@ -1668,11 +1669,6 @@ class Activity { return; } - // store the actor record in XConfig - - // we already store this in Activity::fetch() - // XConfig::Set($url, 'system', 'actor_record', $person_obj); - $name = $person_obj['name'] ?? ''; if (!$name) { $name = $person_obj['preferredUsername'] ?? ''; @@ -4033,7 +4029,8 @@ class Activity { $cache_url = ((strpos($id, '#')) ? substr($id, 0, strpos($id, '#')) : $id); $actor = XConfig::Get($cache_url, 'system', 'actor_record'); - if ($actor) { + if ($actor && isset($actor['actor_cache_date']) && $actor['actor_cache_date'] > datetime_convert('UTC', 'UTC', ' now - 3 days')) { + unset($actor['actor_cache_date']); return $actor; } -- cgit v1.2.3