Skip to content

[3.0] Theme split (wave 1, part 2) — List the maintenance tasks as one pick-one form - #9333

Merged
live627 merged 4 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-maintenance
Aug 2, 2026
Merged

[3.0] Theme split (wave 1, part 2) — List the maintenance tasks as one pick-one form#9333
live627 merged 4 commits into
SimpleMachines:release-3.0from
albertlast:3.0/theme-maintenance

Conversation

@albertlast

@albertlast albertlast commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Wave 1, part 2 of breaking up #7933. Touches one theme template, and it is the one the change is about.

What changes

template_maintain_routine() and template_maintain_database() each hand-wrote a heading, a form and a submit button for every task. Adding a maintenance task meant editing the template. Both are replaced by one template_maintain_options():

foreach (Utils::$context['options'] as $activity => $option) {
	// radio + maintain_<activity> + maintain_<activity>_info
}

Utils::$context['options'] is built from the sub-action's own activities list, so the form and the dispatcher cannot drift apart. A task whose strings are not named maintain_<activity> supplies its own title and info, and after appends markup below the description. The shared wrapper and the "task finished" notice move into a maintain template layer.

Fixes the reported template error

@dragomano reported this on #7933:

Unable to load the '' template at Forum Maintenance - Routine

routine and database are the two sub-actions with no 'template' key, and the dispatcher did

Utils::$context['sub_template'] = !empty(self::$subactions[...]['template']) ? ... : '';

so they asked for a sub-template named ''. They now default to maintain_options.

Language strings

  • maintain_errorsmaintain_repair, so it matches its activity name. Its only consumer was the template being replaced.
  • maintain_cache keeps its name — Admin.template.php and cleanCache() also use it — so cleancache supplies its title and info explicitly. Same for convertentities, since template_convert_entities() still uses the entity_convert_* strings.
  • Adds text_title. Converting the messages body column is offered in both directions now, and the TEXT direction had no heading.
  • Adds convert_to_suggest_text, shown when the maximum message length is at or above 65535, since shrinking the column would truncate posts members can currently make.

Note on scope

#7933 also converts the board picker on the Topics tab to <details> plus a shared template_choose_boards() helper. I left that out, for two reasons: the helper lives in GenericControls.template.php, which belongs to the editor part of the split, and it emits name="brd[]" while TopicRemove::old() reads $_POST['boards'] as an associative array — so on that branch, pruning by selected boards would not do what the form says. That conversion should come with the part that owns the helper, with the field name sorted out.

Testing

  • Routine tab: all six tasks render with real strings, no unresolved language keys.
  • Database tab on PostgreSQL: optimize and convertentities only, convertmsgbody correctly absent.
  • Ran "Recount all forum totals and statistics" through the new form — task executes, the confirmation notice renders, and #manage_maintenance appears exactly once.
  • Members, Topics and Integration Hooks tabs all still render; they do not use the new layer.
  • 108/108 unit tests pass.

🤖 Generated with Claude Code

…e pick-one form

The routine and database maintenance pages each hand-wrote one heading, one
form and one submit button per task, which is why adding a task meant editing
the template. Replace both with a single template_maintain_options() driven by
Utils::$context['options'], built from the sub-action's own activity list so
the two cannot drift apart. A task whose strings are not named
maintain_<activity> supplies its own title and info.

This also fixes the "Unable to load the '' template" error reported on SimpleMachines#7933:
the sub-actions that have no 'template' key left Utils::$context['sub_template']
set to an empty string.

Adds text_title and convert_to_suggest_text: offering to convert the messages
body column back to TEXT needs a heading, and needs to warn when the maximum
message length would no longer fit. Renames maintain_errors to maintain_repair
to match its activity name; maintain_cache keeps its name because the admin
home page uses it too.

Wave 1, part 2 of breaking up SimpleMachines#7933.

Co-Authored-By: John Rayes <live627@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@albertlast albertlast mentioned this pull request Aug 1, 2026
php-cs-fixer's ordered_class_elements and SMF/section_comments rules place
protected methods there.
template_maintain_options() is looked up as 'maintain_options'; 'options'
resolves to a template_options() that does not exist, so the routine and
database tabs died with 'Unable to load the options sub-template'.
@albertlast albertlast changed the title [3.0] Theme split 7/24 — List the maintenance tasks as one pick-one form [3.0] Theme split (wave 1, part 2) — List the maintenance tasks as one pick-one form Aug 1, 2026
@albertlast
albertlast force-pushed the 3.0/theme-maintenance branch from 619ee26 to bf646d6 Compare August 1, 2026 07:28
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Aug 1, 2026
@live627

live627 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

SimpleMachines#8787 removed that direction, and changeMsgBodyLength() returns without
doing anything once the column is MEDIUMTEXT. Rebuilding the maintenance
screen as a pick-one list brought the option back, so on a forum that had
already converted, "Convert to TEXT" appeared and did nothing when run.

Offer the conversion only while the column is still TEXT, and drop the two
language strings SimpleMachines#8787 deleted along with it.
@albertlast

Copy link
Copy Markdown
Collaborator Author

should be better now

@live627
live627 merged commit dab5ddf into SimpleMachines:release-3.0 Aug 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants