aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2021-09-30 17:34:30 +0200
committerMario Vavti <mario@mariovavti.com>2021-09-30 17:34:30 +0200
commit6236869ebed317aa06078f606156edcec9f9b55b (patch)
tree19be979d3200ba90aa77cda4edbf6157755f300a /include
parentb9b4e71f7d81cca23a08c55fc12db5f62ece2b56 (diff)
downloadvolse-hubzilla-6236869ebed317aa06078f606156edcec9f9b55b.tar.gz
volse-hubzilla-6236869ebed317aa06078f606156edcec9f9b55b.tar.bz2
volse-hubzilla-6236869ebed317aa06078f606156edcec9f9b55b.zip
implement file totals and add mod import_progress
Diffstat (limited to 'include')
-rw-r--r--include/api_zot.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/include/api_zot.php b/include/api_zot.php
index 93b99c0c8..dda726787 100644
--- a/include/api_zot.php
+++ b/include/api_zot.php
@@ -305,24 +305,33 @@
if(api_user() === false)
return false;
- $ret = [];
$codebase = ((isset($_REQUEST['zap_compat']) && $_REQUEST['zap_compat']) ? true : false);
$channel = channelx_by_n(api_user());
$page = ((array_key_exists('page',$_REQUEST)) ? intval($_REQUEST['page']) : 0);
+ $ret['success'] = false;
+ $ret['total'] = attach_count_files($channel['channel_id'], get_observer_hash());
+ $ret['results'] = [];
+
+ if (!$ret['total']) {
+ json_return_and_die($ret);
+ }
+
$files = attach_list_files($channel['channel_id'], get_observer_hash(), '', '', '', 'created asc' ,$page, 1);
if (!$files['success']) {
- return false;
+ json_return_and_die($ret);
}
foreach($files['results'] as $file) {
- $ret[] = attach_export_data($channel, $file['hash'], false, $codebase);
+ $ret['results'] = attach_export_data($channel, $file['hash'], false, $codebase);
}
- if($ret) {
+ if($ret['results']) {
+ $ret['success'] = true;
json_return_and_die($ret);
}
+
killme();
}