This commit is contained in:
Mateusz Gruszczyński committed 2026-10-10 00:18:06 +02:00
1 parent ad95bfb050
commit 1431dd47f0
62 files changed
+1360 -198

No files matched your search

+29 -1
View File
@@ -51,7 +51,7 @@ const ids = [
"web-service-response-headers","web-service-rewrites","web-service-root","web-service-search",
"web-service-symlink-policy","web-service-tabs","web-service-try-files",
"web-service-php-profile", "web-service-php-profiles", "web-service-php-profiles-open", "php-fpm-profiles-dialog",
"php-fpm-profiles-list", "php-fpm-profiles-close", "php-fpm-profile-add"
"php-fpm-profiles-list", "php-fpm-profiles-close", "php-fpm-profile-add", "php-fpm-profiles-help"
];
const elements = new Map(ids.map(id => [id, new Element(id)]));
const pages = ["general","routing","htaccess","mime","cache","delivery","php","security"].map(name => {
@@ -193,6 +193,14 @@ context.envelope.config.php_fpm_profiles = [{
// Both entry points must share the existing modal; the toolbar shortcut
// belongs next to New Web Service rather than inside the service editor.
const html = fs.readFileSync("src/admin/web/index.html", "utf8");
const profileDialog = html.split('id="php-fpm-profiles-dialog"')[1]?.split('</dialog>')[0] ?? '';
const listAt = profileDialog.indexOf('id="php-fpm-profiles-list"');
const addAt = profileDialog.indexOf('id="php-fpm-profile-add"');
const dividerAt = profileDialog.indexOf('class="php-profile-help-divider"');
const helpAt = profileDialog.indexOf('id="php-fpm-profiles-help"');
if (!(listAt >= 0 && listAt < addAt && addAt < dividerAt && dividerAt < helpAt)) {
throw new Error("PHP-FPM syntax/safety help must be at the bottom of the profile modal, separated by a rule");
}
const webPanel = html.split('id="panel-web-server"')[1]?.split("</section>")[0] ?? "";
const toolbar = webPanel.match(/<div class="vhost-list-tools">([\s\S]*?)<\/div>/)?.[1] ?? "";
const shortcutAt = toolbar.indexOf('id="web-service-php-profiles-open"');
@@ -209,6 +217,26 @@ if (!elements.get("php-fpm-profiles-dialog").open) throw new Error("PHP-FPM prof
const profileDetail = elements.get("php-fpm-profiles-list").children[0];
if (!profileDetail || profileDetail.children[0].textContent !== "WordPress pool") throw new Error("Shared profile list missing");
const profileForm = profileDetail.children[1];
const phpRows = profileForm.children.filter(node => node.classList.values.has("php-switch-row vh-wide"));
if (phpRows.length !== 3) throw new Error("PHP-FPM / PATH_INFO / Authorization switches do not have separate aligned rows");
for (const row of phpRows) {
if (row.children.length !== 2 || row.children[0].children[0].type !== "checkbox" ||
row.children[1].children[0].textContent !== "i" || row.children[1].children[1].children.length < 1) {
throw new Error("Profile PHP toggle lacks its checkbox label or explanation popover");
}
}
if (!phpRows[0].children[0].children[0].checked || !phpRows[1].children[0].children[0].checked) {
throw new Error("PHP execution and PATH_INFO saved values were not restored");
}
phpRows[1].children[0].children[0].checked = false;
if (!phpRows[0].children[0].children[0].checked) {
throw new Error("Changing PATH_INFO also disabled PHP execution");
}
phpRows[1].children[0].children[0].checked = true;
elements.get("php-fpm-profiles-help").dispatch("click");
if (!elements.get("php-help-dialog").open) throw new Error("PHP profile help button did not open syntax documentation");
elements.get("php-help-close").dispatch("click");
if (elements.get("php-help-dialog").open) throw new Error("PHP syntax help dialog did not close");
profileForm.children[1].children[1].value = "Updated WordPress pool";
await profileForm.dispatch("submit");
if (savedSection?.name !== "php-fpm-profiles" || savedSection.value[0].name !== "Updated WordPress pool") {