From 592359ef497e422d604ccfb43ebc1c51a22b268a Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 5 Apr 2024 11:09:15 +0000 Subject: minor refactor and store import host for possible later use --- Zotlabs/Module/Import.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index e8968c6bd..24b7498dd 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -525,14 +525,21 @@ class Import extends Controller { // This will indirectly perform a refresh_all *and* update the directory Master::Summon(['Directory', $channel['channel_id']]); - $cf_api_compat = true; + if ($api_path) { + $parsed = parse_url($api_path); + unset($parsed['path']); - if ($api_path && $import_posts) { // we are importing from a server and not a file - if (version_compare($data['compatibility']['version'], '6.3.4', '>=')) { + // store the import host so we can manually kick off item/file sync later in case anything did not work out + set_pconfig($channel['channel_id'], 'import', 'host', $parsed['host']); + + $hz_server = unparse_url($parsed); + } - $m = parse_url($api_path); + $cf_api_compat = false; - $hz_server = $m['scheme'] . '://' . $m['host']; + if ($api_path && $hz_server && $import_posts) { // we are importing from a server and not a file + if (version_compare($data['compatibility']['version'], '6.3.4', '>=')) { + $cf_api_compat = true; $since = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), '0001-01-01 00:00'); $until = datetime_convert(date_default_timezone_get(), date_default_timezone_get(), 'now + 1 day'); @@ -543,9 +550,6 @@ class Import extends Controller { Master::Summon(['Content_importer', sprintf('%d', $page), $since, $until, $channel['channel_address'], urlencode($hz_server)]); Master::Summon(['File_importer', sprintf('%d', $page), $channel['channel_address'], urlencode($hz_server)]); } - else { - $cf_api_compat = false; - } } change_channel($channel['channel_id']); -- cgit v1.2.3