From 9a87b8bf1b4384660822f6cb820dbc09e308d07f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Oct 2021 17:24:19 +0200 Subject: only allow resume if we are not completed yet --- Zotlabs/Module/Import_progress.php | 21 +++++++++------------ view/tpl/import_progress.tpl | 6 +++--- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Zotlabs/Module/Import_progress.php b/Zotlabs/Module/Import_progress.php index cc4f0c0ea..06498f649 100644 --- a/Zotlabs/Module/Import_progress.php +++ b/Zotlabs/Module/Import_progress.php @@ -29,11 +29,6 @@ class Import_progress extends \Zotlabs\Web\Controller { } else { - if(argv(1) === 'restart_itemsync') { - Master::Summon($c['next_cmd']); - goaway('/import_progress'); - } - $total_cpages = floor(intval($c['items_total']) / intval($c['items_page'])); if(!$total_cpages) { $total_cpages = 1; // because of floor @@ -43,7 +38,10 @@ class Import_progress extends \Zotlabs\Web\Controller { $cprogress = intval(floor((intval($cpage) * 100) / $total_cpages)); - + if(argv(1) === 'resume_itemsync' && $cprogress < 100) { + Master::Summon($c['next_cmd']); + goaway('/import_progress'); + } } $cprogress_str = ((intval($cprogress)) ? $cprogress . '%' : $cprogress); @@ -55,12 +53,6 @@ class Import_progress extends \Zotlabs\Web\Controller { $fprogress = 'waiting to start...'; } else { - - if(argv(1) === 'restart_filesync') { - Master::Summon($f['next_cmd']); - goaway('/import_progress'); - } - $total_fpages = floor(intval($f['files_total']) / intval($f['files_page'])); if(!$total_fpages) { $total_fpages = 1; @@ -70,6 +62,11 @@ class Import_progress extends \Zotlabs\Web\Controller { $fprogress = intval(floor((intval($fpage) * 100) / $total_fpages)); + if(argv(1) === 'resume_filesync' && $fprogress < 100) { + Master::Summon($f['next_cmd']); + goaway('/import_progress'); + } + } $fprogress_str = ((intval($fprogress)) ? $fprogress . '%' : $fprogress); diff --git a/view/tpl/import_progress.tpl b/view/tpl/import_progress.tpl index 34a93e7c8..2a05661ff 100644 --- a/view/tpl/import_progress.tpl +++ b/view/tpl/import_progress.tpl @@ -15,10 +15,10 @@
-
+
- [ RESUME ] Only resume if sync stalled! + [ RESUME ] Only resume if sync stalled!
Item sync completed! @@ -34,7 +34,7 @@
- [ RESUME ] Only resume if sync stalled! + [ RESUME ] Only resume if sync stalled!
File sync completed! -- cgit v1.2.3