Skip to content

[3.0] End the request when the forum is in maintenance mode - #9481

Merged
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/maintenance-mode-halt
Aug 10, 2026
Merged

[3.0] End the request when the forum is in maintenance mode#9481
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/maintenance-mode-halt

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Maintenance mode does not stop anything. It sets up the notice, sends 503,
and then lets the request it just refused go ahead and run.

Forum::inMaintenance() fills in Utils::$context and returns. preflight()
returns too, and Forum::execute() moves straight on to
self::$current_action->execute().

Two things follow.

The action's side effects all happen. Registering while the forum is in
maintenance creates the member, queues the activation mail, and answers with the
maintenance page — so the only party who does not know the account exists is the
person who just made it:

$ # $maintenance = 1
$ curl -s ... 'index.php?action=signup2' -d 'user=maintuser' ... | grep '<title>'
<title>Maintenance Mode
$ mysql -e "SELECT id_member, member_name FROM smf_members WHERE member_name='maintuser'"
5   maintuser

And what gets drawn is whatever the action left behind. inMaintenance()
sets sub_template, so an action that sets its own wins the page back, and the
board index sets sub_templates and wins it outright. On a forum in maintenance,
as a guest:

Request Shown
index.php the board index, every board and last post
?board=1.0 maintenance notice
?action=help the help page
?action=signup the registration agreement
?action=stats maintenance notice

Only the actions that set neither show the notice, which is why this has looked
like it works.

2.1 made this the action rather than a step before one — return 'InMaintenance'
from smf_main() — so nothing else ever ran.

What changes

inMaintenance() ends the request, the same way User::kickIfGuest() does two
checks later in the same method: Utils::obExit() and then die() for the case
that cannot happen.

Testing

With $maintenance = 1, as a guest: every row in the table above is the
maintenance notice with a 503, and ?action=login is still the login form with a
200. As an admin: the forum is untouched, and logging in fresh through the
maintenance form still works. No new rows in smf_log_errors.

Issues References (Fixes|Related|Closes)

Related to #7933

inMaintenance() sets up the maintenance notice and returns, and preflight()
returns too, so execute() goes straight on to run the action it has just
decided must not run.

Everything that action does still happens. Registering while the forum is in
maintenance creates the member, sends the activation mail and answers with the
maintenance page, so the only party who does not know an account now exists is
the person who made it.

What is drawn is then whatever the action left behind. Anything that sets its
own sub_template - Help, Register - keeps its page, and the board index sets
sub_templates, so the whole forum is readable. Only actions that set neither
show the notice, which is why this looked like it worked.

2.1 made this the action rather than a step before one, so nothing else ever
ran. Exit here instead, the same way kickIfGuest() does.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Aug 10, 2026
@jdarwood007
jdarwood007 merged commit e6c815f into SimpleMachines:release-3.0 Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants