From 55d905fdd934090ce4c6511a3db035e073cd1fcb Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 3 Oct 2021 16:53:48 +0000 Subject: clone channel delete issues - part 2 --- Zotlabs/Lib/Libsync.php | 10 ++++++++++ Zotlabs/Lib/Libzot.php | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 67603a0e3..9118813a7 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -704,6 +704,15 @@ class Libsync { $ret = []; + // If a sender reports that the channel has been deleted, delete its hubloc + if (isset($arr['deleted_locally']) && intval($arr['deleted_locally'])) { + q("UPDATE hubloc SET hubloc_deleted = 1, hubloc_updated = '%s' WHERE hubloc_hash = '%s' AND hubloc_url = '%s'", + dbesc(datetime_convert()), + dbesc($sender['hash']), + dbesc($sender['site']['url']) + ); + } + if ($arr['locations']) { if ($absolute) @@ -861,6 +870,7 @@ class Libsync { $what .= 'delete_hub '; $changed = true; } + continue; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 531b83359..7c9c8a309 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -310,7 +310,6 @@ class Libzot { return false; } - logger('zot-info: ' . print_r($record, true), LOGGER_DATA, LOG_DEBUG); $x = self::import_xchan($record['data'], (($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED)); @@ -616,7 +615,6 @@ class Libzot { */ static function import_xchan($arr, $ud_flags = UPDATE_FLAGS_UPDATED, $ud_arr = null) { - /** * @hooks import_xchan * Called when processing the result of zot_finger() to store the result @@ -666,6 +664,7 @@ class Libzot { $arr['connect_url'] = ''; if ($r) { + if ($arr['photo'] && array_key_exists('updated', $arr['photo']) && $arr['photo']['updated'] > $r[0]['xchan_photo_date']) $import_photos = true; @@ -2880,8 +2879,9 @@ class Libzot { if ($deleted) $ret['deleted'] = $deleted; - if (intval($e['channel_removed'])) + if (intval($e['channel_removed'])) { $ret['deleted_locally'] = true; + } // premium or other channel desiring some contact with potential followers before connecting. // This is a template - %s will be replaced with the follow_url we discover for the return channel. -- cgit v1.2.3