diff options
author | Mario <mario@mariovavti.com> | 2024-04-05 11:09:15 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-04-05 11:09:15 +0000 |
commit | 592359ef497e422d604ccfb43ebc1c51a22b268a (patch) | |
tree | c46a5b8a50d7f81efab0e242934b230b3e99b251 | |
parent | a56d727c2665a80965a1f331bc6423f314d79f6e (diff) | |
download | volse-hubzilla-592359ef497e422d604ccfb43ebc1c51a22b268a.tar.gz volse-hubzilla-592359ef497e422d604ccfb43ebc1c51a22b268a.tar.bz2 volse-hubzilla-592359ef497e422d604ccfb43ebc1c51a22b268a.zip |
minor refactor and store import host for possible later use
-rw-r--r-- | Zotlabs/Module/Import.php | 20 |
1 files 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']); |