aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2021-10-09 20:08:11 +0200
committerMario Vavti <mario@mariovavti.com>2021-10-09 20:08:11 +0200
commit4f2a439873d105b91a5dbbd4dc72d2e2183349a8 (patch)
treed7a950e0940188313bda14faa68ea732eff8cbbd /Zotlabs/Module
parent8ac529f5aec365f6e65c3539779b62cedbd39a28 (diff)
downloadvolse-hubzilla-4f2a439873d105b91a5dbbd4dc72d2e2183349a8.tar.gz
volse-hubzilla-4f2a439873d105b91a5dbbd4dc72d2e2183349a8.tar.bz2
volse-hubzilla-4f2a439873d105b91a5dbbd4dc72d2e2183349a8.zip
mod import: only run automatic content and files import if api version is compatible
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Import.php37
1 files changed, 21 insertions, 16 deletions
diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php
index eee72b945..c4c844b25 100644
--- a/Zotlabs/Module/Import.php
+++ b/Zotlabs/Module/Import.php
@@ -89,8 +89,6 @@ class Import extends Controller {
}
$api_path .= 'channel/export/basic?f=&channel=' . $channelname;
- if ($import_posts)
- $api_path .= '&posts=1';
$binary = false;
$redirects = 0;
@@ -522,31 +520,38 @@ class Import extends Controller {
// This will indirectly perform a refresh_all *and* update the directory
Master::Summon(array('Directory', $channel['channel_id']));
- if ($api_path && $import_posts) { // we are importing from a server and not a file
+ $cf_api_compat = true;
- $m = parse_url($api_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', '>=')) {
- $hz_server = $m['scheme'] . '://' . $m['host'];
+ $m = parse_url($api_path);
- $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');
+ $hz_server = $m['scheme'] . '://' . $m['host'];
- $poll_interval = get_config('system','poll_interval',3);
- $page = 0;
+ $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');
- 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) ]);
+ $poll_interval = get_config('system','poll_interval',3);
+ $page = 0;
+ 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;
+ }
}
- // i do not think this is still used
- //if (array_key_exists('item_id', $data) && $data['item_id'])
- // import_item_ids($channel, $data['item_id']);
-
change_channel($channel['channel_id']);
- if ($api_path && $import_posts)
+ if ($api_path && $import_posts && $cf_api_compat) {
goaway(z_root() . '/import_progress');
+ }
+
+ if (!$cf_api_compat) {
+ notice(t('Automatic content and files import was not possible due to API version incompatiblity. Please import content and files manually!') . EOL);
+ }
goaway(z_root());