diff options
Diffstat (limited to 'Zotlabs/Daemon')
-rw-r--r-- | Zotlabs/Daemon/Cron.php | 4 | ||||
-rw-r--r-- | Zotlabs/Daemon/Cron_daily.php | 4 | ||||
-rw-r--r-- | Zotlabs/Daemon/Expire.php | 4 | ||||
-rw-r--r-- | Zotlabs/Daemon/Fetchparents.php | 42 | ||||
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 18 | ||||
-rw-r--r-- | Zotlabs/Daemon/Zotconvo.php | 17 |
6 files changed, 64 insertions, 25 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index caae0ce53..e0fa2d629 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -124,13 +124,13 @@ class Cron { $r = q("SELECT DISTINCT xchan, content FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", intval(PHOTO_CACHE), db_utcnow(), - db_quoteinterval(get_config('system', 'active_expire_days', '30') . ' DAY') + db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY') ); if ($r) { q("DELETE FROM photo WHERE photo_usage = %d AND expires < %s - INTERVAL %s", intval(PHOTO_CACHE), db_utcnow(), - db_quoteinterval(get_config('system', 'active_expire_days', '30') . ' DAY') + db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY') ); foreach ($r as $rr) { $file = dbunescbin($rr['content']); diff --git a/Zotlabs/Daemon/Cron_daily.php b/Zotlabs/Daemon/Cron_daily.php index 850d38229..98379be1b 100644 --- a/Zotlabs/Daemon/Cron_daily.php +++ b/Zotlabs/Daemon/Cron_daily.php @@ -65,10 +65,10 @@ class Cron_daily { } } - // Clean up emdedded content cache + // Clean up cache q("DELETE FROM cache WHERE updated < %s - INTERVAL %s", db_utcnow(), - db_quoteinterval(get_config('system', 'active_expire_days', '30') . ' DAY') + db_quoteinterval(get_config('system', 'cache_expire_days', 7) . ' DAY') ); //update statistics in config diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php index 84a606dc2..6ab67150f 100644 --- a/Zotlabs/Daemon/Expire.php +++ b/Zotlabs/Daemon/Expire.php @@ -43,8 +43,8 @@ class Expire { logger('expire: start with pid ' . $pid, LOGGER_DEBUG); - $site_expire = intval(get_config('system', 'default_expire_days')); - $commented_days = intval(get_config('system', 'active_expire_days')); + $site_expire = intval(get_config('system', 'default_expire_days', 30)); + $commented_days = intval(get_config('system', 'active_expire_days', 7)); logger('site_expire: ' . $site_expire); diff --git a/Zotlabs/Daemon/Fetchparents.php b/Zotlabs/Daemon/Fetchparents.php new file mode 100644 index 000000000..b00acdfbf --- /dev/null +++ b/Zotlabs/Daemon/Fetchparents.php @@ -0,0 +1,42 @@ +<?php + +namespace Zotlabs\Daemon; + +use Zotlabs\Lib\Activity; + +class Fetchparents { + + static public function run($argc, $argv) { + + logger('Fetchparents invoked: ' . print_r($argv, true)); + + if ($argc < 4) { + return; + } + + $channels = explode(',', $argv[1]); + if (!$channels) { + return; + } + + $observer_hash = $argv[2]; + if (!$observer_hash) { + return; + } + + $mid = $argv[3]; + if (!$mid) { + return; + } + + $force = $argv[4] ?? false; + + foreach ($channels as $channel_id) { + $channel = channelx_by_n($channel_id); + Activity::fetch_and_store_parents($channel, $observer_hash, $mid, null, $force); + } + + return; + + } +} diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 4b74a7ba9..4e7ca3911 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -5,7 +5,6 @@ namespace Zotlabs\Daemon; use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Activity; use Zotlabs\Lib\Queue; -use Zotlabs\Lib\LDSignatures; require_once('include/html2plain.php'); require_once('include/conversation.php'); @@ -271,14 +270,13 @@ class Notifier { // Check for non published items, but allow an exclusion for transmitting hidden file activities if (intval($target_item['item_unpublished']) || intval($target_item['item_delayed']) || - intval($target_item['item_blocked']) || - (intval($target_item['item_hidden']) && ($target_item['obj_type'] !== ACTIVITY_OBJ_FILE))) { + intval($target_item['item_blocked']) || intval($target_item['item_hidden'])) { logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG); return; } // follow/unfollow is for internal use only - if (in_array($target_item['verb'], [ACTIVITY_FOLLOW, ACTIVITY_UNFOLLOW])) { + if (in_array($target_item['verb'], ['Follow', 'Ignore', ACTIVITY_FOLLOW, ACTIVITY_UNFOLLOW])) { logger('not fowarding follow/unfollow note activity'); return; } @@ -342,14 +340,7 @@ class Notifier { self::$encoded_item = json_decode($m, true); } else { - - self::$encoded_item = array_merge(['@context' => [ - ACTIVITYSTREAMS_JSONLD_REV, - 'https://w3id.org/security/v1', - z_root() . ZOT_APSCHEMA_REV - ]], Activity::encode_activity($target_item) - ); - self::$encoded_item['signature'] = LDSignatures::sign(self::$encoded_item, self::$channel); + self::$encoded_item = Activity::build_packet(Activity::encode_activity($target_item), self::$channel, false); } logger('target_item: ' . print_r($target_item, true), LOGGER_DEBUG); @@ -382,7 +373,8 @@ class Notifier { if (($relay_to_owner || $uplink) && ($cmd !== 'relay')) { logger('notifier: followup relay', LOGGER_DEBUG); - $sendto = (($uplink) ? $parent_item['source_xchan'] : (($parent_item['verb'] === ACTIVITY_SHARE) ? $parent_item['author_xchan'] : $parent_item['owner_xchan'])); + // If the Parent item is an Announce the real owner is the parent author + $sendto = (($uplink) ? $parent_item['source_xchan'] : $parent_item['owner_xchan']); self::$recipients = [$sendto]; self::$private = true; $upstream = true; diff --git a/Zotlabs/Daemon/Zotconvo.php b/Zotlabs/Daemon/Zotconvo.php index 16e7f113f..188956d26 100644 --- a/Zotlabs/Daemon/Zotconvo.php +++ b/Zotlabs/Daemon/Zotconvo.php @@ -10,21 +10,26 @@ class Zotconvo { logger('Zotconvo invoked: ' . print_r($argv, true)); - if ($argc != 3) { + if ($argc < 3) { return; } - $mid = $argv[2]; - if (!$mid) { + $channels = explode(',', $argv[1]); + if (!$channels) { return; } - $channel = channelx_by_n(intval($argv[1])); - if (!$channel) { + $mid = $argv[2]; + if (!$mid) { return; } - Libzot::fetch_conversation($channel, $mid); + $force = $argv[3] ?? false; + + foreach ($channels as $channel_id) { + $channel = channelx_by_n($channel_id); + Libzot::fetch_conversation($channel, $mid, $force); + } return; |