diff options
author | Simon Rettberg | 2014-06-11 15:27:54 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-06-11 15:27:54 +0200 |
commit | 898a9a997e5cf1ea89d6658e67c57705422c7ac4 (patch) | |
tree | 03c198078fef1b5d7d1bd4af095d10b3ce4c75a2 /inc/taskmanager.inc.php | |
parent | Add animation class slx-rotation that will make an element rotate (used for "... (diff) | |
download | slx-admin-898a9a997e5cf1ea89d6658e67c57705422c7ac4.tar.gz slx-admin-898a9a997e5cf1ea89d6658e67c57705422c7ac4.tar.xz slx-admin-898a9a997e5cf1ea89d6658e67c57705422c7ac4.zip |
1) Improve Taskmanager error handling 2) add uptime display to status page, finally closes #953
Diffstat (limited to 'inc/taskmanager.inc.php')
-rw-r--r-- | inc/taskmanager.inc.php | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/inc/taskmanager.inc.php b/inc/taskmanager.inc.php index b61714ec..1bbdb7a5 100644 --- a/inc/taskmanager.inc.php +++ b/inc/taskmanager.inc.php @@ -30,26 +30,15 @@ class Taskmanager $message = "$seq, $task, $data"; $sent = socket_send(self::$sock, $message, strlen($message), 0); if ($sent != strlen($message)) { - Message::addError('taskmanager-error'); + self::addErrorMessage(false); return false; } if ($async) return true; $reply = self::readReply($seq); - if ($reply === false) { - Message::addError('taskmanager-error'); - return false; - } - if (!is_array($reply)) { - Message::addError('taskmanager-format'); - return false; - } - if (isset($reply['statusCode']) && $reply['statusCode'] === NO_SUCH_TASK) { - Message::addError('task-error', 'Ungültiger Task: ' . $task); - return false; - } - if (!isset($reply['id'])) { - Message::addError('taskmanager-format'); + if ($reply === false || !is_array($reply) || !isset($reply['id']) + || (isset($reply['statusCode']) && $reply['statusCode'] === NO_SUCH_TASK)) { + self::addErrorMessage(false); return false; } return $reply; @@ -102,7 +91,7 @@ class Taskmanager return true; return false; } - + public static function addErrorMessage($task) { static $failure = false; |