From 7c740d5c6dcd2051db6cf365af966950303af608 Mon Sep 17 00:00:00 2001 From: albertlast Date: Sun, 13 Sep 2026 07:11:51 +0200 Subject: [PATCH] Runs the welcome step's checks when installing from the command line Install::welcome() returns as soon as contbutt is set, which is how a submitted welcome form moves on. From the command line contbutt has to be passed with every run, so the PHP version, database, session and manifest checks never ran there, and a CLI install went ahead on a checkout with missing or altered files. On the command line the checks now always run, and decide whether the install continues. install-forum.sh removes a manifest that is not part of HEAD before resetting, unstaging it first if it was staged, so the entrypoint builds a fresh one from the current checkout rather than the installer checking edited files against an old one. Co-Authored-By: Claude Opus 5 Signed-off-by: albertlast --- .docker/install-forum.sh | 13 +++++++++++++ Sources/Maintenance/Tools/Install.php | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.docker/install-forum.sh b/.docker/install-forum.sh index 8bc55700270..8f0fd02da57 100755 --- a/.docker/install-forum.sh +++ b/.docker/install-forum.sh @@ -75,6 +75,19 @@ install_one() { return 0 fi + # The installer checks every file against the manifest, and the entrypoint + # builds that manifest from the checkout only when there is none. One built + # before the checkout was last edited would fail the check, so a manifest + # that is not part of HEAD is removed here, from the index too if it was + # staged. When reset.sh restarts the container the entrypoint builds a fresh + # one, or leaves it absent on a dirty working tree, which a development + # version's installer accepts. + if git rev-parse --is-inside-work-tree >/dev/null 2>&1 \ + && ! git cat-file -e HEAD:Sources/Maintenance/manifest.php 2>/dev/null; then + git rm -q --cached --ignore-unmatch Sources/Maintenance/manifest.php + rm -f Sources/Maintenance/manifest.php + fi + log "${smf_type}: resetting" "$DOCKER_DIR/reset.sh" --engine "$smf_type" >/dev/null diff --git a/Sources/Maintenance/Tools/Install.php b/Sources/Maintenance/Tools/Install.php index 4ae4b1e426d..3b879913193 100644 --- a/Sources/Maintenance/Tools/Install.php +++ b/Sources/Maintenance/Tools/Install.php @@ -255,8 +255,9 @@ public function getStepTitle(): string */ public function welcome(): bool { - // Done the submission? - if (isset($_POST['contbutt'])) { + // Done the submission? From the command line contbutt is passed with every + // run, so there it cannot mean the checks below were seen and passed. + if (isset($_POST['contbutt']) && !Sapi::isCLI()) { // Does the admin want debug info? $this->debug = isset($_POST['debug']); @@ -362,6 +363,11 @@ public function welcome(): bool Utils::$context['continue'] = true; } + // There is no page to show on the command line, so carry on unless a check failed. + if (Sapi::isCLI()) { + return empty(Maintenance::$errors) && empty(Maintenance::$fatal_error); + } + return false; }