[3.0] End the request when the forum is in maintenance mode - #9481
Merged
jdarwood007 merged 1 commit intoAug 10, 2026
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inUtils::$contextand returns.preflight()returns too, and
Forum::execute()moves straight on toself::$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:
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 theboard index sets
sub_templatesand wins it outright. On a forum in maintenance,as a guest:
index.php?board=1.0?action=help?action=signup?action=statsOnly 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 wayUser::kickIfGuest()does twochecks later in the same method:
Utils::obExit()and thendie()for the casethat cannot happen.
Testing
With
$maintenance = 1, as a guest: every row in the table above is themaintenance notice with a 503, and
?action=loginis still the login form with a200. 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