aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib/Activity.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-29 10:33:13 +0000
committerMario <mario@mariovavti.com>2024-01-29 10:33:13 +0000
commit29489f62cfc27705a0993532929c244d9d99b7bf (patch)
tree665cbe3c1dfc80b92278223e677d503e42d979fd /Zotlabs/Lib/Activity.php
parent09465619e53c9c0a04ee73cecc3fc2d87ee74d55 (diff)
downloadvolse-hubzilla-29489f62cfc27705a0993532929c244d9d99b7bf.tar.gz
volse-hubzilla-29489f62cfc27705a0993532929c244d9d99b7bf.tar.bz2
volse-hubzilla-29489f62cfc27705a0993532929c244d9d99b7bf.zip
introduce Activity::init_background_fetch() and refactor zotconvo to implement it
Diffstat (limited to 'Zotlabs/Lib/Activity.php')
-rw-r--r--Zotlabs/Lib/Activity.php57
1 files changed, 51 insertions, 6 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index a6a194045..a795d8590 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -2712,12 +2712,8 @@ class Activity {
}
if ($fetch_parents) {
- // Cache::set($item['mid'], 'json:' . $act->raw);
- App::$cache['fetch_objects'][$item['mid']]['channels'][] = $channel['channel_id'];
- App::$cache['fetch_objects'][$item['mid']]['force'] = intval($force);
-
- //Master::Summon(['Fetchparents', $channel['channel_id'], $observer_hash, $item['mid'], $force]);
- //self::fetch_and_store_parents($channel, $observer_hash, $item, $act, $force);
+ App::$cache['as_fetch_objects'][$item['mid']]['channels'][] = $channel['channel_id'];
+ App::$cache['as_fetch_objects'][$item['mid']]['force'] = intval($force);
return;
}
}
@@ -3699,5 +3695,54 @@ class Activity {
return $arr;
}
+ /**
+ * @brief Prepares the arguments and inititates the Fetchparents or Zotconvo daemon.
+ * @param string $observer
+ *
+ */
+
+ public static function init_background_fetch(string $observer_hash = '') {
+ hz_syslog(print_r(App::$cache, true));
+
+ if (isset(App::$cache['zot_fetch_objects'])) {
+ $channels_str = '';
+
+ foreach (App::$cache['zot_fetch_objects'] as $mid => $info) {
+ $force = $info['force'];
+
+ foreach ($info['channels'] as $c) {
+ if ($channels_str) {
+ $channels_str .= ',';
+ }
+ $channels_str .= $c;
+ }
+
+ Master::Summon(['Zotconvo', $channels_str, $mid, $force]);
+ }
+ }
+
+ if (isset(App::$cache['as_fetch_objects'])) {
+ if (!$observer_hash) {
+ logger('Attempt to initiate Fetchparents daemon without observer');
+ return;
+ }
+
+ $channels_str = '';
+
+ foreach (App::$cache['as_fetch_objects'] as $mid => $info) {
+ $force = $info['force'];
+
+ foreach ($info['channels'] as $c) {
+ if ($channels_str) {
+ $channels_str .= ',';
+ }
+ $channels_str .= $c;
+ }
+
+ Master::Summon(['Fetchparents', $channels_str, $observer_hash, $mid, $force]);
+ }
+ }
+ }
+
}