Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
89547c395f | ||
|
|
89aef8100b | ||
|
|
9608427a4c | ||
|
|
a2c91c5d85 | ||
|
|
0e2a066968 | ||
|
|
15cd30fa3b | ||
|
|
432741d6a4 | ||
|
|
b395a198b1 | ||
|
|
1eca2566e8 |
No files matched your search
@@ -37,7 +37,7 @@ jobs:
|
|||||||
Attach-arm64:
|
Attach-arm64:
|
||||||
# Only from trunk: the arm64 is built from the dispatched ref's Dockerfile.
|
# Only from trunk: the arm64 is built from the dispatched ref's Dockerfile.
|
||||||
if: github.ref == 'refs/heads/trunk'
|
if: github.ref == 'refs/heads/trunk'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
# missing — see scripts/tests/lsphp-info-probe.test.sh for what went wrong
|
# missing — see scripts/tests/lsphp-info-probe.test.sh for what went wrong
|
||||||
# and why it needed a test outside the image build to catch it.
|
# and why it needed a test outside the image build to catch it.
|
||||||
Shell-Checks:
|
Shell-Checks:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||||
@@ -166,7 +166,7 @@ jobs:
|
|||||||
# job below takes its matrix from here and is skipped when its list is empty.
|
# job below takes its matrix from here and is skipped when its list is empty.
|
||||||
# Push events and an empty `only` input plan the full set, as before.
|
# Push events and an empty `only` input plan the full set, as before.
|
||||||
plan:
|
plan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
outputs:
|
outputs:
|
||||||
cac: ${{ steps.plan.outputs.cac }}
|
cac: ${{ steps.plan.outputs.cac }}
|
||||||
@@ -188,7 +188,7 @@ jobs:
|
|||||||
Build-and-Push:
|
Build-and-Push:
|
||||||
needs: plan
|
needs: plan
|
||||||
if: needs.plan.outputs.cac != '[]'
|
if: needs.plan.outputs.cac != '[]'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
timeout-minutes: 130
|
timeout-minutes: 130
|
||||||
strategy:
|
strategy:
|
||||||
# One PHP version failing (e.g. an EOL stream) must not cancel the
|
# One PHP version failing (e.g. an EOL stream) must not cancel the
|
||||||
@@ -396,7 +396,7 @@ jobs:
|
|||||||
Build-FPM-Images:
|
Build-FPM-Images:
|
||||||
needs: plan
|
needs: plan
|
||||||
if: needs.plan.outputs.cac_fpm != '[]'
|
if: needs.plan.outputs.cac_fpm != '[]'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
timeout-minutes: 130
|
timeout-minutes: 130
|
||||||
strategy:
|
strategy:
|
||||||
# One PHP version failing (e.g. an EOL stream) must not cancel the
|
# One PHP version failing (e.g. an EOL stream) must not cancel the
|
||||||
@@ -607,7 +607,7 @@ jobs:
|
|||||||
Build-LiteSpeed-Images:
|
Build-LiteSpeed-Images:
|
||||||
needs: plan
|
needs: plan
|
||||||
if: needs.plan.outputs.cac_litespeed != '[]'
|
if: needs.plan.outputs.cac_litespeed != '[]'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
# One place for the OLS base tag: digest lookup and build-args both read it.
|
# One place for the OLS base tag: digest lookup and build-args both read it.
|
||||||
# OLS_VERSION pinned to 1.8.4 (see the build step); Dockerfile default differs.
|
# OLS_VERSION pinned to 1.8.4 (see the build step); Dockerfile default differs.
|
||||||
env:
|
env:
|
||||||
@@ -769,7 +769,7 @@ jobs:
|
|||||||
Build-LSPHP-Images:
|
Build-LSPHP-Images:
|
||||||
needs: plan
|
needs: plan
|
||||||
if: needs.plan.outputs.cac_lsphp != '[]'
|
if: needs.plan.outputs.cac_lsphp != '[]'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
# One place for the OLS base tag: digest lookup and build-args both read it.
|
# One place for the OLS base tag: digest lookup and build-args both read it.
|
||||||
# OLS_VERSION pinned to 1.8.4 (see the build step); Dockerfile default differs.
|
# OLS_VERSION pinned to 1.8.4 (see the build step); Dockerfile default differs.
|
||||||
env:
|
env:
|
||||||
@@ -929,7 +929,7 @@ jobs:
|
|||||||
Build-Shared-httpd:
|
Build-Shared-httpd:
|
||||||
needs: plan
|
needs: plan
|
||||||
if: needs.plan.outputs.shared_httpd == 'true'
|
if: needs.plan.outputs.shared_httpd == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
timeout-minutes: 80
|
timeout-minutes: 80
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -1115,7 +1115,7 @@ jobs:
|
|||||||
Build-Shared-OLS:
|
Build-Shared-OLS:
|
||||||
needs: plan
|
needs: plan
|
||||||
if: needs.plan.outputs.shared_ols == 'true'
|
if: needs.plan.outputs.shared_ols == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
# One place for the OLS base tag: digest lookup and build-args both read it.
|
# One place for the OLS base tag: digest lookup and build-args both read it.
|
||||||
env:
|
env:
|
||||||
OLS_VERSION: "1.8.4"
|
OLS_VERSION: "1.8.4"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build-lsphp-from-source:
|
Build-lsphp-from-source:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ run-name: mod_whp_symlink probe test for ${{ gitea.actor }}
|
|||||||
## fails the job. Run the same thing locally: docs/shared-httpd-symlink-module.md.
|
## fails the job. Run the same thing locally: docs/shared-httpd-symlink-module.md.
|
||||||
##
|
##
|
||||||
## Untrusted code: this runs PR-supplied Dockerfile/C source. Gitea has only the
|
## Untrusted code: this runs PR-supplied Dockerfile/C source. Gitea has only the
|
||||||
## shared `ubuntu-latest` runners (no separate label for untrusted jobs), the same
|
## `ephemeral` runners (a fresh LXC per job, never reused), the same label as
|
||||||
## ones the publish jobs use, so this job is hardened instead: no secrets and no registry
|
## the publish jobs, so this job is hardened anyway: no secrets and no registry
|
||||||
## login, `--pull --no-cache`, a per-run image tag, and an `if: always()`
|
## login, `--pull --no-cache`, a per-run image tag, and an `if: always()`
|
||||||
## cleanup. The publish builds (build-push.yaml) use their own fresh buildx
|
## cleanup. The publish builds (build-push.yaml) use their own fresh buildx
|
||||||
## builder with `pull: true` / `no-cache: true`, so nothing built here can be
|
## builder with `pull: true` / `no-cache: true`, so nothing built here can be
|
||||||
@@ -27,7 +27,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
Symlink-Module-Probe:
|
Symlink-Module-Probe:
|
||||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
||||||
runs-on: ubuntu-latest
|
runs-on: ephemeral
|
||||||
timeout-minutes: 40
|
timeout-minutes: 40
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ COPY ./configs/prod-php.ini /etc/php.ini
|
|||||||
COPY ./configs/zz-php2shell-mitigation.ini /etc/php.d/zz-php2shell-mitigation.ini
|
COPY ./configs/zz-php2shell-mitigation.ini /etc/php.d/zz-php2shell-mitigation.ini
|
||||||
COPY ./configs/phpinfo.php /var/www/html/
|
COPY ./configs/phpinfo.php /var/www/html/
|
||||||
COPY ./configs/mariadb.repo /etc/yum.repos.d/
|
COPY ./configs/mariadb.repo /etc/yum.repos.d/
|
||||||
|
# MariaDB client defaults: connect to the WHP mysql container whatever the client/server series.
|
||||||
|
COPY ./configs/whp-mariadb-client.cnf /etc/my.cnf.d/zz-whp-client.cnf
|
||||||
# mirror.mariadb.org names the arch dir amd64/aarch64 (not $basearch); amd64 result is byte-identical.
|
# mirror.mariadb.org names the arch dir amd64/aarch64 (not $basearch); amd64 result is byte-identical.
|
||||||
RUN sed -i "s/rhel\$releasever-amd64/rhel\$releasever-$(uname -m | sed s/x86_64/amd64/)/" /etc/yum.repos.d/mariadb.repo
|
RUN sed -i "s/rhel\$releasever-amd64/rhel\$releasever-$(uname -m | sed s/x86_64/amd64/)/" /etc/yum.repos.d/mariadb.repo
|
||||||
COPY ./configs/index.php /var/www/html/
|
COPY ./configs/index.php /var/www/html/
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ COPY ./configs/prod-php.ini /etc/php.ini
|
|||||||
# all images ship PHP >= 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12.
|
# all images ship PHP >= 8.2.35 / 8.3.36 / 8.4.27 / 8.5.12.
|
||||||
COPY ./configs/zz-php2shell-mitigation.ini /etc/php.d/zz-php2shell-mitigation.ini
|
COPY ./configs/zz-php2shell-mitigation.ini /etc/php.d/zz-php2shell-mitigation.ini
|
||||||
COPY ./configs/mariadb.repo /etc/yum.repos.d/
|
COPY ./configs/mariadb.repo /etc/yum.repos.d/
|
||||||
|
# MariaDB client defaults: connect to the WHP mysql container whatever the client/server series.
|
||||||
|
COPY ./configs/whp-mariadb-client.cnf /etc/my.cnf.d/zz-whp-client.cnf
|
||||||
# mirror.mariadb.org names the arch dir amd64/aarch64 (not $basearch); amd64 result is byte-identical.
|
# mirror.mariadb.org names the arch dir amd64/aarch64 (not $basearch); amd64 result is byte-identical.
|
||||||
RUN sed -i "s/rhel\$releasever-amd64/rhel\$releasever-$(uname -m | sed s/x86_64/amd64/)/" /etc/yum.repos.d/mariadb.repo
|
RUN sed -i "s/rhel\$releasever-amd64/rhel\$releasever-$(uname -m | sed s/x86_64/amd64/)/" /etc/yum.repos.d/mariadb.repo
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Client defaults for the mariadb/mysql/mariadb-dump CLIs in this image.
|
||||||
|
#
|
||||||
|
# The MariaDB server runs in WHP's separate `mysql` container, reached over
|
||||||
|
# the docker bridge. An 11.x client defaults to "TLS required, verify the
|
||||||
|
# certificate": against a 10.11 server it fails with
|
||||||
|
# ERROR 2026: SSL is required, but the server does not support it
|
||||||
|
# and against an 11.x server with a passwordless account with "self-signed
|
||||||
|
# certificate". This image ships a 10.11 client today (no effect), but WP-CLI
|
||||||
|
# `wp db ...`, mysqldump and any client a customer adds would break the day the
|
||||||
|
# client series differs from the server's.
|
||||||
|
#
|
||||||
|
# ssl-verify-server-cert=0 (measured on mariadb:11.8 and 10.11.18 clients vs
|
||||||
|
# 10.11.18 and 11.8 servers) keeps TLS negotiated when the server offers it and
|
||||||
|
# stops the verification/"required" failure, so a customer who points the CLI at
|
||||||
|
# a remote TLS database is not downgraded to plaintext. A customer who wants
|
||||||
|
# verification passes --ssl-verify-server-cert or sets it in ~/.my.cnf (later
|
||||||
|
# files and the command line win).
|
||||||
|
[client]
|
||||||
|
ssl-verify-server-cert=0
|
||||||
@@ -128,7 +128,7 @@ cmd_check() {
|
|||||||
fi
|
fi
|
||||||
# Positive control: nothing the platform uses may have disappeared with them.
|
# Positive control: nothing the platform uses may have disappeared with them.
|
||||||
for m in $REQUIRED_MODULES; do
|
for m in $REQUIRED_MODULES; do
|
||||||
if ! printf '%s\n' "$mods" | grep -qE "^ ${m} "; then
|
if ! grep -qE "^ ${m} " <<<"$mods"; then
|
||||||
echo "gate FAIL: required module ${m} is NOT loaded" >&2; fail=1
|
echo "gate FAIL: required module ${m} is NOT loaded" >&2; fail=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Regular → Executable
+24
-9
@@ -37,7 +37,6 @@ LSWSCTRL="${LSWSCTRL:-/usr/local/lsws/bin/lswsctrl}"
|
|||||||
## render-shared-ols-config.sh; overridable so tests can run without OLS).
|
## render-shared-ols-config.sh; overridable so tests can run without OLS).
|
||||||
LSWS_CONF="${OLS_LSWS_CONF:-/usr/local/lsws/conf}"
|
LSWS_CONF="${OLS_LSWS_CONF:-/usr/local/lsws/conf}"
|
||||||
SITES_ROOT="${OLS_SITES_ROOT:-${SITES_ROOT:-$LSWS_CONF/shared-sites}}"
|
SITES_ROOT="${OLS_SITES_ROOT:-${SITES_ROOT:-$LSWS_CONF/shared-sites}}"
|
||||||
last_restart=0
|
|
||||||
|
|
||||||
## Set of vhost docRoot directories (absolute, no trailing slash), keyed by
|
## Set of vhost docRoot directories (absolute, no trailing slash), keyed by
|
||||||
## path. Rebuilt from $SITES_ROOT/*/vhconf.conf only when the rendered
|
## path. Rebuilt from $SITES_ROOT/*/vhconf.conf only when the rendered
|
||||||
@@ -92,15 +91,31 @@ is_docroot_htaccess() {
|
|||||||
|
|
||||||
log() { echo "ols-htaccess-watcher: $*" >&2; }
|
log() { echo "ols-htaccess-watcher: $*" >&2; }
|
||||||
|
|
||||||
|
## Time comes from bash's $SECONDS (monotonic w.r.t. wall-clock steps, no fork
|
||||||
|
## per check). A backward clock jump therefore cannot stretch the floor wait, and
|
||||||
|
## the drain loops below stay cheap even when unrelated churn under $WATCH_ROOT
|
||||||
|
## makes `read` return instantly on every event.
|
||||||
|
last_restart="" # $SECONDS of the last restart ATTEMPT; empty = none yet
|
||||||
|
|
||||||
do_restart() {
|
do_restart() {
|
||||||
path="$1"
|
path="$1"
|
||||||
now=$(date +%s)
|
local wait_until
|
||||||
if [ $((now - last_restart)) -lt "$FLOOR" ]; then
|
if [ -n "$last_restart" ] && [ $((SECONDS - last_restart)) -lt "$FLOOR" ]; then
|
||||||
log "within ${FLOOR}s floor — coalescing, skipping restart ($path)"
|
## COALESCE, don't drop: an edit inside the floor window used to be
|
||||||
return
|
## discarded, so it never applied until some later edit happened. Instead
|
||||||
|
## wait out the remainder of the window (hard-bounded by FLOOR), draining
|
||||||
|
## the event stream meanwhile so the pipe cannot back up, then restart ONCE
|
||||||
|
## for everything that arrived. A burst of N edits still costs one restart.
|
||||||
|
wait_until=$((last_restart + FLOOR))
|
||||||
|
log "within ${FLOOR}s floor — deferring restart to end of window ($path)"
|
||||||
|
while [ "$SECONDS" -lt "$wait_until" ]; do
|
||||||
|
read -r -t 1 _ || true
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
## Stamp the ATTEMPT (not only success) so a failing lswsctrl is also limited
|
||||||
|
## to one try per FLOOR instead of retrying on every event.
|
||||||
|
last_restart=$SECONDS
|
||||||
if "$LSWSCTRL" restart >/dev/null 2>&1; then
|
if "$LSWSCTRL" restart >/dev/null 2>&1; then
|
||||||
last_restart=$now
|
|
||||||
log "graceful restart issued — $path changed"
|
log "graceful restart issued — $path changed"
|
||||||
else
|
else
|
||||||
log "WARNING: lswsctrl restart failed ($path)"
|
log "WARNING: lswsctrl restart failed ($path)"
|
||||||
@@ -135,7 +150,7 @@ log "watching $WATCH_ROOT for vhost-docroot .htaccess changes (debounce=${DEBOUN
|
|||||||
## directories is what ties a change to something OLS will reread. (Legacy
|
## directories is what ties a change to something OLS will reread. (Legacy
|
||||||
## */public_html/.htaccess match is kept only when that set is empty.)
|
## */public_html/.htaccess match is kept only when that set is empty.)
|
||||||
inotifywait -m -r -e modify,create,delete,move "$WATCH_ROOT" --format '%w%f' 2>/dev/null |
|
inotifywait -m -r -e modify,create,delete,move "$WATCH_ROOT" --format '%w%f' 2>/dev/null |
|
||||||
while read -r path; do
|
while IFS= read -r path; do
|
||||||
is_docroot_htaccess "$path" || continue
|
is_docroot_htaccess "$path" || continue
|
||||||
## A tenant DOCROOT .htaccess changed. Coalesce the save-burst, then restart ONCE.
|
## A tenant DOCROOT .htaccess changed. Coalesce the save-burst, then restart ONCE.
|
||||||
##
|
##
|
||||||
@@ -146,8 +161,8 @@ while read -r path; do
|
|||||||
## events only until the deadline OR ~2s of total quiet, whichever comes first,
|
## events only until the deadline OR ~2s of total quiet, whichever comes first,
|
||||||
## so continuous activity can delay us by at most DEBOUNCE. do_restart's FLOOR
|
## so continuous activity can delay us by at most DEBOUNCE. do_restart's FLOOR
|
||||||
## then rate-limits across consecutive bursts.
|
## then rate-limits across consecutive bursts.
|
||||||
deadline=$(( $(date +%s) + DEBOUNCE ))
|
deadline=$((SECONDS + DEBOUNCE))
|
||||||
while [ "$(date +%s)" -lt "$deadline" ]; do
|
while [ "$SECONDS" -lt "$deadline" ]; do
|
||||||
if read -r -t 2 _; then
|
if read -r -t 2 _; then
|
||||||
continue # more activity — keep coalescing toward the deadline
|
continue # more activity — keep coalescing toward the deadline
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -124,7 +124,12 @@ for p in pa:ajp pf:ftp ps:scgi pu:uwsgi; do
|
|||||||
# error log, which names the missing scheme handler only when the module is gone.
|
# error log, which names the missing scheme handler only when the module is gone.
|
||||||
if [ "$EXPECT_OPEN" = 1 ]; then ok "[P] ${p##*:}:// : not asserted on an unhardened image"; continue; fi
|
if [ "$EXPECT_OPEN" = 1 ]; then ok "[P] ${p##*:}:// : not asserted on an unhardened image"; continue; fi
|
||||||
l=$(docker exec "$N" sh -c "grep -c 'No protocol handler was valid for the URL /${p%%:*}/' /var/log/httpd/a.test-error.log 2>/dev/null || true")
|
l=$(docker exec "$N" sh -c "grep -c 'No protocol handler was valid for the URL /${p%%:*}/' /var/log/httpd/a.test-error.log 2>/dev/null || true")
|
||||||
|
# The server-scope proxy guard now answers 403 BEFORE mod_proxy picks a handler, so the
|
||||||
|
# request never reaches the scheme lookup and AH01144 is no longer logged. A 403 is the
|
||||||
|
# secure outcome (the [P] is refused); AH01144 is the older one (module removed). Anything
|
||||||
|
# else (502/503/500/200, i.e. a proxy attempt or served content) is a failure.
|
||||||
if [ "${l:-0}" -ge 1 ]; then ok "[P] ${p##*:}:// has no protocol handler (AH01144 for /${p%%:*}/)"
|
if [ "${l:-0}" -ge 1 ]; then ok "[P] ${p##*:}:// has no protocol handler (AH01144 for /${p%%:*}/)"
|
||||||
|
elif [ "$(printf %s "${r: -5}" | tr -d '\n')" = "[403]" ]; then ok "[P] ${p##*:}:// refused by the proxy guard (403) before any handler lookup"
|
||||||
else bad "[P] ${p##*:}://: no 'No protocol handler' for /${p%%:*}/ in the error log -> ${r: -12}"; fi
|
else bad "[P] ${p##*:}://: no 'No protocol handler' for /${p%%:*}/ in the error log -> ${r: -12}"; fi
|
||||||
done
|
done
|
||||||
echo "== surfaces that must stay (reported, not failed)"
|
echo "== surfaces that must stay (reported, not failed)"
|
||||||
|
|||||||
@@ -10,9 +10,17 @@ W="$HERE/ols-htaccess-watcher.sh"
|
|||||||
if ! command -v inotifywait >/dev/null 2>&1; then
|
if ! command -v inotifywait >/dev/null 2>&1; then
|
||||||
echo "SKIP - inotifywait (inotify-tools) not installed; watcher test not run"; exit 0
|
echo "SKIP - inotifywait (inotify-tools) not installed; watcher test not run"; exit 0
|
||||||
fi
|
fi
|
||||||
|
## The watcher must be executable as checked out (CI run 6313 failed with
|
||||||
|
## "Permission denied" because git tracked it 100644; the image chmods it, a bare
|
||||||
|
## checkout does not). Assert it, and launch via bash so the test never depends on it.
|
||||||
|
if [ ! -x "$W" ]; then echo "FAIL - $W is not executable (git mode must be 100755)"; exit 1; fi
|
||||||
T=$(mktemp -d)
|
T=$(mktemp -d)
|
||||||
WPID=""
|
WPID=""
|
||||||
cleanup() { [ -n "$WPID" ] && kill "$WPID" 2>/dev/null || true; pkill -P "${WPID:-0}" 2>/dev/null || true; rm -rf "$T"; }
|
## Stop children (inotifywait + the while-subshell) BEFORE the parent: once the
|
||||||
|
## parent is dead they are reparented and `pkill -P` no longer finds them, and the
|
||||||
|
## leaked watcher would keep restarting against later sections.
|
||||||
|
stopw() { [ -n "$WPID" ] || return 0; pkill -P "$WPID" 2>/dev/null || true; kill "$WPID" 2>/dev/null || true; WPID=""; }
|
||||||
|
cleanup() { stopw; rm -rf "$T"; }
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
fail=0
|
fail=0
|
||||||
ok() { echo "ok - $1"; }
|
ok() { echo "ok - $1"; }
|
||||||
@@ -36,7 +44,7 @@ chmod +x "$T/lswsctrl"
|
|||||||
|
|
||||||
start() {
|
start() {
|
||||||
env OLS_WATCH_ROOT="$U" OLS_LSWS_CONF="$CONF" OLS_SITES_ROOT="$SITES" LSWSCTRL="$T/lswsctrl" \
|
env OLS_WATCH_ROOT="$U" OLS_LSWS_CONF="$CONF" OLS_SITES_ROOT="$SITES" LSWSCTRL="$T/lswsctrl" \
|
||||||
OLS_HTACCESS_DEBOUNCE=1 OLS_HTACCESS_FLOOR=0 "$W" 2>"$T/log" &
|
OLS_HTACCESS_DEBOUNCE=1 OLS_HTACCESS_FLOOR="${FLOOR_T:-0}" bash "$W" 2>"$T/log" &
|
||||||
WPID=$!
|
WPID=$!
|
||||||
sleep 1.5
|
sleep 1.5
|
||||||
}
|
}
|
||||||
@@ -63,7 +71,7 @@ mkdir -p "$U/u4/d.example/public_html/pub"
|
|||||||
mkdir -p "$SITES/d"; printf 'docRoot %s\n' "$U/u4/d.example/public_html/pub" >"$SITES/d/vhconf.conf"
|
mkdir -p "$SITES/d"; printf 'docRoot %s\n' "$U/u4/d.example/public_html/pub" >"$SITES/d/vhconf.conf"
|
||||||
echo '# cfg2' >"$CONF/.tmp" && mv "$CONF/.tmp" "$CONF/httpd_config.conf"
|
echo '# cfg2' >"$CONF/.tmp" && mv "$CONF/.tmp" "$CONF/httpd_config.conf"
|
||||||
check "site added after start (re-render) triggers" 1 "$U/u4/d.example/public_html/pub/.htaccess"
|
check "site added after start (re-render) triggers" 1 "$U/u4/d.example/public_html/pub/.htaccess"
|
||||||
kill "$WPID" 2>/dev/null || true; pkill -P "$WPID" 2>/dev/null || true; WPID=""
|
stopw
|
||||||
|
|
||||||
## Fallback: no vhconf files -> legacy */public_html/.htaccess match
|
## Fallback: no vhconf files -> legacy */public_html/.htaccess match
|
||||||
rm -rf "$SITES"; mkdir -p "$SITES"
|
rm -rf "$SITES"; mkdir -p "$SITES"
|
||||||
@@ -71,4 +79,22 @@ start
|
|||||||
check "fallback (empty docRoot set): public_html/.htaccess triggers" 1 "$U/u3/c.example/public_html/.htaccess"
|
check "fallback (empty docRoot set): public_html/.htaccess triggers" 1 "$U/u3/c.example/public_html/.htaccess"
|
||||||
check "fallback: deep plugin file still does NOT" 0 "$U/u1/a.example/public_html/wp-content/cache/x/.htaccess"
|
check "fallback: deep plugin file still does NOT" 0 "$U/u1/a.example/public_html/wp-content/cache/x/.htaccess"
|
||||||
|
|
||||||
|
stopw
|
||||||
|
|
||||||
|
## Floor window: an edit inside it is DEFERRED to the window end (one restart),
|
||||||
|
## not dropped; a burst of several edits inside it still costs a single restart.
|
||||||
|
FLOOR_T=8
|
||||||
|
start
|
||||||
|
: >"$T/restarts"
|
||||||
|
H="$U/u3/c.example/public_html/.htaccess"
|
||||||
|
echo a >>"$H"; sleep 4
|
||||||
|
r1=$(count)
|
||||||
|
echo b >>"$H"; sleep 0.5; echo c >>"$H"; sleep 1
|
||||||
|
r2=$(count)
|
||||||
|
sleep 9
|
||||||
|
r3=$(count)
|
||||||
|
[ "$r1" -eq 1 ] && ok "floor: first edit restarts immediately" || bad "floor: first edit (restarts $r1, want 1)"
|
||||||
|
[ "$r2" -eq 1 ] && ok "floor: edits inside window do not restart early" || bad "floor: early restart (restarts $r2, want 1)"
|
||||||
|
[ "$r3" -eq 2 ] && ok "floor: edits inside window coalesce into ONE deferred restart" || bad "floor: deferred restart (restarts $r3, want 2)"
|
||||||
|
|
||||||
[ "$fail" -eq 0 ] && echo "ALL PASS" || { echo "FAILURES"; cat "$T/log"; exit 1; }
|
[ "$fail" -eq 0 ] && echo "ALL PASS" || { echo "FAILURES"; cat "$T/log"; exit 1; }
|
||||||
Reference in new issue
Block a user