summaryrefslogtreecommitdiffstats
path: root/modules/minilinux.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2014-06-02 20:03:27 +0200
committerSimon Rettberg2014-06-02 20:03:27 +0200
commite2bfe6c411a05e3332d754e01ae2ad46a0bcb770 (patch)
tree33b7b6d1d8cb2626cc26738d7b05f8e69dae4cc2 /modules/minilinux.inc.php
parentFix tracking of js taskmanager poller status; remove obsolete hack from taskm... (diff)
downloadslx-admin-e2bfe6c411a05e3332d754e01ae2ad46a0bcb770.tar.gz
slx-admin-e2bfe6c411a05e3332d754e01ae2ad46a0bcb770.tar.xz
slx-admin-e2bfe6c411a05e3332d754e01ae2ad46a0bcb770.zip
Continue to show minilinux download status even when refreshing the page
Diffstat (limited to 'modules/minilinux.inc.php')
-rw-r--r--modules/minilinux.inc.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/modules/minilinux.inc.php b/modules/minilinux.inc.php
index 78535ba6..48f7c4f6 100644
--- a/modules/minilinux.inc.php
+++ b/modules/minilinux.inc.php
@@ -39,7 +39,13 @@ class Page_MiniLinux extends Page
$local = CONFIG_HTTP_DIR . '/' . $system['id'] . '/' . $file['name'];
if (!file_exists($local) || filesize($local) !== $file['size'] || md5_file($local) !== substr($file['md5'], 0, 32)) {
$file['changed'] = true;
- $file['taskid'] = Property::getDownloadTask($file['md5']);
+ }
+ $taskId = Property::getDownloadTask($file['md5']);
+ if ($taskId !== false) {
+ $file['download'] = Render::parse('minilinux/download', array(
+ 'task' => $taskId,
+ 'name' => $file['name']
+ ));
}
}
}
@@ -55,16 +61,16 @@ class Page_MiniLinux extends Page
echo "Invalid download request";
return;
}
- $found = false;
+ $file = false;
foreach ($data['systems'] as &$system) {
if ($system['id'] !== $id) continue;
- foreach ($system['files'] as &$file) {
- if ($file['name'] !== $name) continue;
- $found = true;
+ foreach ($system['files'] as &$f) {
+ if ($f['name'] !== $name) continue;
+ $file = $f;
break;
}
}
- if (!$found) {
+ if ($file === false) {
echo "Nonexistent system/file: $id / $name";
return;
}
@@ -76,6 +82,7 @@ class Page_MiniLinux extends Page
echo 'Error launching download task: ' . $task['statusCode'];
return;
}
+ Property::setDownloadTask($file['md5'], $task['id']);
echo Render::parse('minilinux/download', array(
'name' => $name,
'task' => $task['id']