aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-02-08 14:09:54 +0000
committerMario <mario@mariovavti.com>2022-02-08 14:09:54 +0000
commita8d87af41844c8598a9ef58a8f900831d1f7ea03 (patch)
tree9e58d5163bf27097c7dadd3747875b3eea4455bb /Zotlabs/Lib/Activity.php
parenta0e8e40f1c9b60afd901091df792cafcc943a0a4 (diff)
downloadvolse-hubzilla-a8d87af41844c8598a9ef58a8f900831d1f7ea03.tar.gz
volse-hubzilla-a8d87af41844c8598a9ef58a8f900831d1f7ea03.tar.bz2
volse-hubzilla-a8d87af41844c8598a9ef58a8f900831d1f7ea03.zip
to reduce overall network fetches cache actors in Activity::fetch() and fetch the ldsig creator with get_actor() instead of get_compound_property() so that it will check the cache before actually fetching
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 159f2a46f..e51922c86 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -116,6 +116,11 @@ class Activity {
$y = json_decode($x['body'], true);
logger('returned: ' . json_encode($y, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES), LOGGER_DEBUG);
+
+ if (ActivityStreams::is_an_actor($y['type'])) {
+ XConfig::Set($y['id'], 'system', 'actor_record', $y);
+ }
+
return json_decode($x['body'], true);
}
else {
@@ -3709,7 +3714,10 @@ class Activity {
}
static function get_cached_actor($id) {
- $actor = XConfig::Get($id, 'system', 'actor_record');
+
+ // remove any fragments like #main-key since these won't be present in our cached data
+ $cache_url = ((strpos($id, '#')) ? substr($id, 0, strpos($id, '#')) : $id);
+ $actor = XConfig::Get($cache_url, 'system', 'actor_record');
if ($actor) {
return $actor;
@@ -3718,7 +3726,7 @@ class Activity {
// try other get_cached_actor providers (e.g. diaspora)
$hookdata = [
'id' => $id,
- 'actor' => false
+ 'actor' => null
];
call_hooks('get_cached_actor_provider', $hookdata);