Added passeneg manager. Part 2

This commit is contained in:
Alexey Berezhok
2024-12-13 23:31:05 +03:00
parent 4a10c586e1
commit 455223af4b
3 changed files with 88 additions and 5 deletions

View File

@@ -1,4 +1,6 @@
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
$TAB = "EXTMODULES";
// Main include
@@ -10,10 +12,42 @@ if ($_SESSION["userContext"] != "admin") {
exit();
}
exec(HESTIA_CMD . "v-ext-modules state passenger_manager json", $output, $return_var);
$check_passenger_enabled = json_decode(implode("", $output), true);
if (($return_var != 0) || (empty($check_passenger_enabled)) || ($check_passenger_enabled[0]["STATE"] != "enabled")){
header("Location: /list/extmodules/");
exit();
}
unset($output);
$error_message = "";
if ((!empty($_GET["del"])) && ($_GET["del"] != "")) {
//Delete item
$path = quoteshellarg($_GET["del"]);
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager del_ruby " . $path, $output, $return_var);
if ($return_var != 0){
$error_message = $output;
}
unset($output);
} else if ((!empty($_GET["add"])) && ($_GET["add"] != "")) {
//Delete item
$path = quoteshellarg($_GET["add"]);
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager add_ruby " . $path, $output, $return_var);
if ($return_var != 0){
$error_message = $output;
}
unset($output);
}
// Data
exec(HESTIA_CMD . "v-ext-modules-run passenger_manager get_rubys json", $output, $return_var);
$rubys = json_decode(implode("", $output), true);
ksort($rubys);
$rubys = [];
if ($return_var != 0) {
$rubys = json_decode(implode("", $output), true);
ksort($rubys);
} else {
$error_message = $output;
}
unset($output);