summaryrefslogtreecommitdiffstats
path: root/inc/taskmanager.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-09 17:31:19 +0200
committerSimon Rettberg2019-10-09 17:31:19 +0200
commitf800abeea4f6c68182c51cd4aaea19d7636431c8 (patch)
tree802f9bcee14210b355cac211751449e31c71fbc0 /inc/taskmanager.inc.php
parentslx-fixes: Expose function for adding additional automatic confirm handlers (diff)
downloadslx-admin-f800abeea4f6c68182c51cd4aaea19d7636431c8.tar.gz
slx-admin-f800abeea4f6c68182c51cd4aaea19d7636431c8.tar.xz
slx-admin-f800abeea4f6c68182c51cd4aaea19d7636431c8.zip
[minilinux] Rewrite for multiple version/sources handling
* You can supply multiple sources for updates (URLs) * Sources can provide multiple branches * Each branch can supply multiple versions (eg. updates) TODO: Set global default version TODO: Supply hook to serversetup-ipxe to add specific boot entries TODO: UX polish TODO: phpdoc/polish
Diffstat (limited to 'inc/taskmanager.inc.php')
-rw-r--r--inc/taskmanager.inc.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/inc/taskmanager.inc.php b/inc/taskmanager.inc.php
index 8fe70d00..547a75d4 100644
--- a/inc/taskmanager.inc.php
+++ b/inc/taskmanager.inc.php
@@ -175,6 +175,22 @@ class Taskmanager
return false;
}
+ /**
+ * Check whether the given task is running, that is either waiting for execution
+ * or currently executing.
+ *
+ * @param array $task struct representing task, obtained by ::status
+ * @return boolean true if task is waiting or executing, false if waiting for execution or currently executing, no valid task, etc.
+ */
+ public static function isRunning($task)
+ {
+ if (!is_array($task) || !isset($task['statusCode']) || !isset($task['id']))
+ return false;
+ if ($task['statusCode'] === Taskmanager::TASK_WAITING || $task['statusCode'] === Taskmanager::TASK_PROCESSING)
+ return true;
+ return false;
+ }
+
public static function addErrorMessage($task)
{
static $failure = false;