9 Commits

Author SHA1 Message Date
Ilia Ross
95c974edc4 Fix comments on skipped Apache conditionals
This patch fixes comments before skipped `IfModule`, `IfDefine`, and `IfVersion` blocks being attached to the next parsed directive.

For example:

```apache
# SSL-only settings
<IfModule mod_ssl.c>
    SSLEngine on
</IfModule>
ServerName example.test
```

When `mod_ssl` was unavailable, Webmin attached `# SSL-only settings` to `ServerName`. Deleting `ServerName` could then remove the wrong line and produce:

```apache
# SSL-only settings
<IfModule mod_ssl.c>
    SSLEngine on
```

This fix clears comments belonging to skipped conditionals. Deleting `ServerName` now leaves the complete `IfModule` block unchanged.
2026-09-20 17:22:17 +02:00
Jamie Cameron
1b029fb2c3 Merge pull request #2847 from webmin/dev/preserve-apache-comments
Add Apache comment preservation
2026-09-19 17:33:05 -07:00
Ilia Ross
efe1dddca8 Fix to change Apache comments to use directive fields
https://github.com/webmin/webmin/pull/2847#issuecomment-5705632150
2026-09-17 01:46:50 +02:00
Ilia Ross
dcd929e7e3 Add Apache comment preservation
This PR fixes full-line comments being removed when Webmin rewrites Apache configuration blocks.
2026-09-17 00:07:52 +02:00
Ilia Ross
faaef530f2 Drop Apache comment preservation from this PR 2026-09-17 00:01:01 +02:00
Ilia Ross
3d27aca04a Fix nested Apache directive rewrites
This PR fixes incorrect line numbers when Apache directives contain nested blocks.

It preserves comments during rewrites and correctly tracks every nested line.

This prevents Virtualmin from corrupting custom Apache configurations.

Fixes: https://github.com/virtualmin/virtualmin-gpl/issues/1153
2026-09-16 23:00:38 +02:00
Ilia Ross
52d0382619 Fix regression and hide disabled default vhost files 2026-05-19 23:28:24 +02:00
Ilia Ross
d93fd6a4b6 Fix to harden vhost file handling
* Note: Resolve enabled-site link paths through ServerRoot and include disabled vhost file deletions in Apache config-test rollback coverage, with focused regressions.

https://github.com/webmin/webmin/actions/runs/26125036339/job/76836427985
2026-05-19 23:16:09 +02:00
Ilia Ross
a5be2f9d39 Add Debian-style sites-available file management to Apache
* Note: Bring the Apache module to parity with the Nginx module's Debian
sites-available/sites-enabled handling: list disabled vhost files
alongside active ones, toggle their state via symlink with apachectl
configtest rollback, and delete VirtualHost blocks from inactive files.
When Virtualmin manages a vhost, defer enable/disable to Virtualmin's
own forms instead of touching the symlink directly.

https://forum.virtualmin.com/t/enable-disable-toggle-buttons-in-ngnix-module/137238/4?u=ilia
2026-05-19 23:00:18 +02:00