This commit is contained in:
Alexey Berezhok
2026-05-03 16:32:53 +03:00
parent 8add078e7c
commit a3888d10b4
10 changed files with 267 additions and 5 deletions

View File

@@ -17,11 +17,11 @@ exec(
$output,
$return_var,
);
$check_passenger_enabled = json_decode(implode("", $output), true);
$check_bunkerweb_enabled = json_decode(implode("", $output), true);
if (
$return_var != 0 ||
empty($check_passenger_enabled) ||
$check_passenger_enabled[0]["STATE"] != "enabled"
empty($check_bunkerweb_enabled) ||
$check_bunkerweb_enabled[0]["STATE"] != "enabled"
) {
header("Location: /list/extmodules/");
exit();

View File

@@ -0,0 +1,64 @@
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
$TAB = "EXTMODULES";
// Main include
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check user
if ($_SESSION["userContext"] != "admin") {
header("Location: /list/user");
exit();
}
exec(
HESTIA_CMD . "v-ext-modules state update_module json",
$output,
$return_var,
);
$check_update_enabled = json_decode(implode("", $output), true);
if (
$return_var != 0 ||
empty($check_update_enabled) ||
$check_update_enabled[0]["STATE"] != "enabled"
) {
header("Location: /list/extmodules/");
exit();
}
unset($output);
$error_message = "";
if (isset($_GET["action"]) && $_GET["action"] === "update") {
exec(
HESTIA_CMD . "v-ext-modules-run update_module synctemplates",
$output,
$return_var,
);
if ($return_var != 0) {
$error_message = $output;
}
unset($output);
}
// Data
exec(
HESTIA_CMD . "v-ext-modules-run update_module listsynctemplates json",
$output,
$return_var,
);
$synctemplates_list = [];
if ($return_var == 0) {
$synctemplates_list = json_decode(implode("", $output), true);
} else {
$error_message = implode("<br/>\n", $output);
}
unset($output);
// Render page
render_page($user, $TAB, "extmodules/extmodules_update_module");
// Back uri
$_SESSION["back"] = $_SERVER["REQUEST_URI"];

View File

@@ -0,0 +1,63 @@
<!-- Begin toolbar -->
<div class="toolbar">
<div class="toolbar-inner">
<div class="toolbar-buttons">
<a class="button button-secondary button-back js-button-back" href="/list/extmodules/">
<i class="fas fa-arrow-left icon-blue"></i><?= _("Back") ?>
</a>
<a class="button button-secondary button-back js-button-back" href="/extm/update_module/edit/?action=update">
<i class="fas fa-refresh icon-green"></i><?= _("Update files") ?>
</a>
</div>
</div>
</div>
<!-- End toolbar -->
<div class="container">
<?php if (!empty($error_message)) { ?>
<div class="u-text-center inline-alert inline-alert-danger u-mb20" role="alert">
<i class="fas fa-circle-exclamation"></i>
<p><?= $error_message ?></p>
</div>
<?php } ?>
<h1 class="u-text-center u-mt20 u-pr30 u-mb20 u-pl30">
<?= _("List of web templates need to update") ?>
</h1>
<div class="units-table js-units-container">
<div class="units-table-header">
<div class="units-table-cell u-text-center"><?= _("File name") ?></div>
<div class="units-table-cell u-text-center"><?= _("Old file size") ?></div>
<div class="units-table-cell u-text-center"><?= _("New file size") ?></div>
</div>
<?php foreach ($synctemplates_list as $key => $value) { ?>
<div class="units-table-row js-unit">
<div class="units-table-cell u-text-center">
<span class="u-hide-desktop"><?= _("File name") ?>:</span>
<?php echo $synctemplates_list[$key]["FILE_NAME"]; ?>
</div>
<div class="units-table-cell u-text-center">
<span class="u-hide-desktop"><?= _("Old file size") ?>:</span>
<?php echo $synctemplates_list[$key]["OLD_SIZE"]; ?>
</div>
<div class="units-table-cell u-text-center">
<span class="u-hide-desktop"><?= _("New file size") ?>:</span>
<?php echo $synctemplates_list[$key]["NEW_SIZE"]; ?>
</div>
</div>
<?php } ?>
</div>
</div>
<footer class="app-footer">
<div class="container app-footer-inner">
<p>
<?= _("Update templates list") ?>.
</p>
</div>
</footer>