aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2021-10-01 17:24:19 +0200
committerMario Vavti <mario@mariovavti.com>2021-10-01 17:24:19 +0200
commit9a87b8bf1b4384660822f6cb820dbc09e308d07f (patch)
tree7e41f84de7fcd8aaa3a4cdeb4794ccd34a15afe0
parentdac27aab6810473fa020120d348c51dcf93e2d79 (diff)
downloadvolse-hubzilla-9a87b8bf1b4384660822f6cb820dbc09e308d07f.tar.gz
volse-hubzilla-9a87b8bf1b4384660822f6cb820dbc09e308d07f.tar.bz2
volse-hubzilla-9a87b8bf1b4384660822f6cb820dbc09e308d07f.zip
only allow resume if we are not completed yet
-rw-r--r--Zotlabs/Module/Import_progress.php21
-rw-r--r--view/tpl/import_progress.tpl6
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 @@
<div id="cprogress">
<div class="progress mb-2">
- <div id="cprogress-bar" class="progress-bar progress-bar-striped bg-warning{{if $fprogress < 100}} progress-bar-animated{{/if}}" role="progressbar" style="width: {{$cprogress}}%" aria-valuenow="{{$cprogress}}" aria-valuemin="0" aria-valuemax="100"></div>
+ <div id="cprogress-bar" class="progress-bar progress-bar-striped bg-warning{{if $cprogress < 100}} progress-bar-animated{{/if}}" role="progressbar" style="width: {{$cprogress}}%" aria-valuenow="{{$cprogress}}" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div id="cprogress-resume" class="">
- <a href="/import_progress/restart_itemsync">[ RESUME ]</a> <span class="text-muted">Only resume if sync stalled!</span>
+ <a href="/import_progress/resume_itemsync">[ RESUME ]</a> <span class="text-muted">Only resume if sync stalled!</span>
</div>
<div id="cprogress-complete" class="d-none">
<span class="text-muted">Item sync completed!</span>
@@ -34,7 +34,7 @@
<div id="fprogress-bar" class="progress-bar progress-bar-striped bg-info{{if $fprogress < 100}} progress-bar-animated{{/if}}" role="progressbar" style="width: {{$fprogress}}%" aria-valuenow="{{$fprogress}}" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div id="fprogress-resume" class="{{if $fprogress == 100}}d-none{{/if}}">
- <a href="/import_progress/restart_filesync">[ RESUME ]</a> <span class="text-muted">Only resume if sync stalled!</span>
+ <a href="/import_progress/resume_filesync">[ RESUME ]</a> <span class="text-muted">Only resume if sync stalled!</span>
</div>
<div id="fprogress-complete" class="{{if $fprogress < 100}}d-none{{/if}}">
<span class="text-muted">File sync completed!</span>