summaryrefslogtreecommitdiffstats
path: root/modules-available/rebootcontrol
diff options
context:
space:
mode:
authorSimon Rettberg2017-05-09 12:24:31 +0200
committerSimon Rettberg2017-05-09 12:24:31 +0200
commit717cac27efd48dc41e49cadabf8555480d21db26 (patch)
tree2155282e6e5443a0a0c97fd9bfb22400263dccbd /modules-available/rebootcontrol
parent[systemstatus] Put overview in tab too (diff)
downloadslx-admin-717cac27efd48dc41e49cadabf8555480d21db26.tar.gz
slx-admin-717cac27efd48dc41e49cadabf8555480d21db26.tar.xz
slx-admin-717cac27efd48dc41e49cadabf8555480d21db26.zip
[rebootcontrol] API call for rebuilding all modules
Diffstat (limited to 'modules-available/rebootcontrol')
-rw-r--r--modules-available/rebootcontrol/api.inc.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules-available/rebootcontrol/api.inc.php b/modules-available/rebootcontrol/api.inc.php
index 77687f8e..dad25375 100644
--- a/modules-available/rebootcontrol/api.inc.php
+++ b/modules-available/rebootcontrol/api.inc.php
@@ -1,4 +1,13 @@
<?php
+
+if (Request::any('action') === 'rebuild' && isLocalExecution()) {
+ if (Module::isAvailable('sysconfig')) {
+ SSHKey::getPublicKey();
+ ConfigTgz::rebuildAllConfigs();
+ echo "OK";
+ }
+ exit(0);
+}
/*
Needed POST-Parameters:
'token' -- for authentification
@@ -15,7 +24,8 @@ foreach ($ips as $client) {
$clients[] = array("ip" => $client);
}
-if (Request::post('token') == Property::get("rebootcontrol_APIPOSTKEY")) {
+$apikey = Property::get("rebootcontrol_APIPOSTKEY", 'not-set');
+if (!empty($apikey) && Request::post('token') === $apikey) {
if (Request::isPost()) {
if (Request::post('action') == 'shutdown') {
$shutdown = true;