From 6236869ebed317aa06078f606156edcec9f9b55b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 30 Sep 2021 17:34:30 +0200 Subject: implement file totals and add mod import_progress --- Zotlabs/Daemon/File_importer.php | 12 +++++-- Zotlabs/Module/Import_progress.php | 66 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 Zotlabs/Module/Import_progress.php (limited to 'Zotlabs') diff --git a/Zotlabs/Daemon/File_importer.php b/Zotlabs/Daemon/File_importer.php index bb12cdf70..28fb172a7 100644 --- a/Zotlabs/Daemon/File_importer.php +++ b/Zotlabs/Daemon/File_importer.php @@ -48,12 +48,18 @@ class File_importer { $j = json_decode($x['body'],true); - if(! is_array($j[0]['attach']) || ! count($j[0]['attach'])) { - PConfig::Set($channel['channel_id'], 'import', 'files', 1); + if(! is_array($j['results'][0]['attach']) || ! count($j['results'][0]['attach'])) { return; } - $r = sync_files($channel,$j); + $r = sync_files($channel, $j['results']); + + PConfig::Set($channel['channel_id'], 'import', 'files_progress', [ + 'files_total' => $j['total'], + 'files_page' => 1, // export page atm returns just one file + 'last_page' => $page, + 'next_cmd' => ['File_importer',sprintf('%d',$page + 1), $channel['channel_address'], urlencode($hz_server)] + ]); $page++; diff --git a/Zotlabs/Module/Import_progress.php b/Zotlabs/Module/Import_progress.php new file mode 100644 index 000000000..3bae94bbb --- /dev/null +++ b/Zotlabs/Module/Import_progress.php @@ -0,0 +1,66 @@ +' . $co . ''; + if (is_array($c)) + $o .= '
' . htmlspecialchars(print_array($c)) . '
'; + + $o .= '

' . $fo . '

'; + if (is_array($f)) + $o .= '
' . htmlspecialchars(print_array($f)) . '
'; + + $o .= '

Refresh page for updates!

'; + + return $o; + } + +} -- cgit v1.2.3