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 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Zotlabs/Lib/Libsync.php') 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; } -- cgit v1.2.3 From 538e54053126ed4adf200802fb9298ec3212b085 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 4 Oct 2021 08:46:56 +0000 Subject: commment out deprecated code --- Zotlabs/Lib/Libsync.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Lib/Libsync.php') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 9118813a7..2b47fcf1a 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -255,8 +255,8 @@ class Libsync { if (array_key_exists('chatroom', $arr) && $arr['chatroom']) sync_chatrooms($channel, $arr['chatroom']); - if (array_key_exists('mail', $arr) && $arr['mail']) - sync_mail($channel, $arr['mail']); + //if (array_key_exists('mail', $arr) && $arr['mail']) + // sync_mail($channel, $arr['mail']); if (array_key_exists('event', $arr) && $arr['event']) sync_events($channel, $arr['event']); @@ -270,8 +270,8 @@ class Libsync { // deprecated, maintaining for a few months for upward compatibility // this should sync webpages, but the logic is a bit subtle - if (array_key_exists('item_id', $arr) && $arr['item_id']) - sync_items($channel, $arr['item_id']); + //if (array_key_exists('item_id', $arr) && $arr['item_id']) + // sync_items($channel, $arr['item_id']); if (array_key_exists('menu', $arr) && $arr['menu']) sync_menus($channel, $arr['menu']); -- cgit v1.2.3 From 6da7fe7d27b30f691c07e5fb767afc904c3063c0 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 4 Oct 2021 09:24:13 +0000 Subject: provide system app sync --- Zotlabs/Lib/Libsync.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zotlabs/Lib/Libsync.php') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 2b47fcf1a..e08f14447 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -246,6 +246,10 @@ class Libsync { if (array_key_exists('app', $arr) && $arr['app']) sync_apps($channel, $arr['app']); + if (array_key_exists('sysapp',$arr) && $arr['sysapp']) { + sync_sysapps($channel,$arr['sysapp']); + } + if (array_key_exists('addressbook', $arr) && $arr['addressbook']) sync_addressbook($channel, $arr['addressbook']); -- cgit v1.2.3 From 11ea7bf0fc7f35cb205e0de40622c88a0bed9f66 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 4 Oct 2021 11:25:52 +0000 Subject: app sync fixes - part 1 --- Zotlabs/Lib/Libsync.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib/Libsync.php') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index e08f14447..1157428b4 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -247,7 +247,7 @@ class Libsync { sync_apps($channel, $arr['app']); if (array_key_exists('sysapp',$arr) && $arr['sysapp']) { - sync_sysapps($channel,$arr['sysapp']); + sync_sysapps($channel, $arr['sysapp']); } if (array_key_exists('addressbook', $arr) && $arr['addressbook']) -- cgit v1.2.3 From 16281e0e7fbc4ff691f6190ddc80632b411d2801 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 4 Oct 2021 19:16:38 +0000 Subject: disable app sync due to a possible loop --- Zotlabs/Lib/Libsync.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/Libsync.php') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index 1157428b4..d4ed57c3a 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -242,14 +242,14 @@ class Libsync { if (array_key_exists('likes', $arr) && $arr['likes']) import_likes($channel, $arr['likes']); - +/* if (array_key_exists('app', $arr) && $arr['app']) sync_apps($channel, $arr['app']); if (array_key_exists('sysapp',$arr) && $arr['sysapp']) { sync_sysapps($channel, $arr['sysapp']); } - +*/ if (array_key_exists('addressbook', $arr) && $arr['addressbook']) sync_addressbook($channel, $arr['addressbook']); -- cgit v1.2.3 From c33660a015ff4a2ed387caa4064fc8c4d8655419 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 6 Oct 2021 09:36:14 +0200 Subject: move sync logic for apps to mod appman. this way we can re-use the functions without creating sync loops. --- Zotlabs/Lib/Libsync.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Lib/Libsync.php') diff --git a/Zotlabs/Lib/Libsync.php b/Zotlabs/Lib/Libsync.php index d4ed57c3a..c4f1b20ea 100644 --- a/Zotlabs/Lib/Libsync.php +++ b/Zotlabs/Lib/Libsync.php @@ -141,7 +141,6 @@ class Libsync { logger('Packet: ' . print_r($info, true), LOGGER_DATA, LOG_DEBUG); $total = count($synchubs); - foreach ($synchubs as $hub) { $hash = random_string(); $n = Libzot::build_packet($channel, 'sync', $env_recips, json_encode($info), 'hz', $hub['hubloc_sitekey'], $hub['site_crypto']); @@ -186,7 +185,6 @@ class Libsync { require_once('include/import.php'); $result = []; - $keychange = ((array_key_exists('keychange', $arr)) ? true : false); foreach ($deliveries as $d) { @@ -242,14 +240,14 @@ class Libsync { if (array_key_exists('likes', $arr) && $arr['likes']) import_likes($channel, $arr['likes']); -/* + if (array_key_exists('app', $arr) && $arr['app']) sync_apps($channel, $arr['app']); if (array_key_exists('sysapp',$arr) && $arr['sysapp']) { sync_sysapps($channel, $arr['sysapp']); } -*/ + if (array_key_exists('addressbook', $arr) && $arr['addressbook']) sync_addressbook($channel, $arr['addressbook']); -- cgit v1.2.3