summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2018-04-24 15:54:00 +0200
committerSimon Rettberg2018-04-24 15:54:00 +0200
commitb48e755affc865547ab148340f586ae9a297c8f5 (patch)
treef15da9b1ced06785594467fe84fd63db34900461 /modules-available/rebootcontrol/page.inc.php
parent[translation] Satelliten-Server -> Satellitenserver (diff)
downloadslx-admin-b48e755affc865547ab148340f586ae9a297c8f5.tar.gz
slx-admin-b48e755affc865547ab148340f586ae9a297c8f5.tar.xz
slx-admin-b48e755affc865547ab148340f586ae9a297c8f5.zip
[rebootcontrol] Try clients first that are known to be online
This prevents long delays if a large amount of clients is selected where the majority is offline.
Diffstat (limited to 'modules-available/rebootcontrol/page.inc.php')
-rw-r--r--modules-available/rebootcontrol/page.inc.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules-available/rebootcontrol/page.inc.php b/modules-available/rebootcontrol/page.inc.php
index 041ae74f..675c94f8 100644
--- a/modules-available/rebootcontrol/page.inc.php
+++ b/modules-available/rebootcontrol/page.inc.php
@@ -49,7 +49,13 @@ class Page_RebootControl extends Page
Message::addError('no-clients-selected');
Util::redirect();
}
-
+ usort($actualClients, function($a, $b) {
+ $a = ($a['state'] === 'IDLE' || $a['state'] === 'OCCUPIED');
+ $b = ($b['state'] === 'IDLE' || $b['state'] === 'OCCUPIED');
+ if ($a === $b)
+ return 0;
+ return $a ? -1 : 1;
+ });
$task = RebootControl::execute($actualClients, $this->action === 'shutdown', $minutes, $locationId);
Util::redirect("?do=rebootcontrol&taskid=".$task["id"]);
}