diff options
author | Simon Rettberg | 2018-04-25 16:47:06 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-04-25 16:47:06 +0200 |
commit | d863b362f2531c85b24b391e363380aebc917b6e (patch) | |
tree | 671342636b1447bf974ef3b8cdbe821d684c1899 | |
parent | [rebootcontrol] Nicer status list; list of all running jobs (diff) | |
download | slx-admin-d863b362f2531c85b24b391e363380aebc917b6e.tar.gz slx-admin-d863b362f2531c85b24b391e363380aebc917b6e.tar.xz slx-admin-d863b362f2531c85b24b391e363380aebc917b6e.zip |
[inc/Taskmanager] isTask() Only query if taskId is given
-rw-r--r-- | inc/taskmanager.inc.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/inc/taskmanager.inc.php b/inc/taskmanager.inc.php index ed64c613..945e759d 100644 --- a/inc/taskmanager.inc.php +++ b/inc/taskmanager.inc.php @@ -83,13 +83,17 @@ class Taskmanager * Checks whether the given task id corresponds to a known task in the taskmanager. * Returns true iff the taskmanager is reachable and the status of the task * is different from NO_SUCH_TASK. + * If you pass an array it is assumed that it was already queried and is evaluated + * directly. * - * @param string $taskid a task id + * @param string|array $taskid a task id or a task array returned by ::status or ::submit * @return boolean true if taskid exists in taskmanager */ - public static function isTask($taskid) + public static function isTask($task) { - $task = self::status($taskid); + if (is_string($task)) { + $task = self::status($task); + } return isset($task['statusCode']) && $task['statusCode'] !== NO_SUCH_TASK; } |