Skip to content

Maintenance (Bundled Extension) Since 3.5.0

totalcms/maintenance — bundled with Total CMS. Adds a maintenance page feature that returns a 503 Service Unavailable response with a custom message. Different from T3’s site-wide MaintenanceModeMiddleware — this targets individual pages so you can take one section offline while the rest of the site keeps running.

  • Section-level downtime. “The shop is being updated” without taking the blog offline.
  • Pre-launch placeholder. A page exists in the builder but shows “coming soon” until you’re ready.
  • Controlled rollout. Take a page down, deploy changes to its template, then remove the maintenance config.
  1. Go to Admin → Extensions, find Maintenance, click Enable (or run tcms extension:enable totalcms/maintenance).
  2. Open a page in Site Builder, tick maintenance under Features.
  3. Add the maintenance config to the page’s Page Data JSON field:
    {
    "maintenance": {
    "message": "This section is being updated. Back at 5pm EST.",
    "retryAfterMinutes": 60
    }
    }
  4. Visitors see a 503 page with your message. Logged-in admins bypass the gate and see the page normally.

Set inside the page’s Page Data JSON field as maintenance. The middleware reads page.data.maintenance.

{
"maintenance": {
"message": "We're updating this section. Check back shortly.",
"retryAfterMinutes": 30
}
}
KeyTypeDefaultDescription
messagestring"This page is temporarily unavailable."The message shown to visitors. Plain text — HTML is escaped.
retryAfterMinutesint60How long to tell crawlers and well-behaved clients to wait before retrying, in minutes. Emitted as the Retry-After response header in seconds (minutes × 60).

Logged-in admin users (anyone with an active AUTH_USER session) bypass the maintenance gate automatically. This lets you preview the page while it’s in maintenance mode — useful for verifying changes before removing the gate.

AspectValue
Status code503 Service Unavailable
Retry-After headerretryAfterMinutes × 60 seconds (default 60 min → 3600)
Content-Typetext/html; charset=utf-8
BodyMinimal styled HTML with the message
<meta name="robots">noindex, nofollow

The 503 status code tells search engines the page is temporarily down — they won’t de-index it (unlike a 404 or 410). The Retry-After header gives crawlers a hint about when to check back.

  • No maintenance key in page data → middleware does nothing; page renders normally.
  • maintenance is not an object (e.g. true, "yes", a number) → middleware does nothing.
  • Empty message → falls back to the default message.
  • Non-numeric retryAfterMinutes → falls back to the default (60 minutes).
  • message contains HTML → escaped with htmlspecialchars() to prevent XSS.

For pages that use multiple features, order them thoughtfully:

  1. auth — check login first (so the admin bypass fires before maintenance)
  2. maintenance — then check maintenance mode
  3. Other features (protect, scheduled, etc.)

If maintenance runs before auth, the admin bypass still works (it checks the session directly), but logged-out admins would see the maintenance page instead of being redirected to login.

Go to Admin → Extensions → Maintenance and click Disable, or run:

Terminal window
tcms extension:disable totalcms/maintenance

When disabled, maintenance disappears from the page-features picker. Pages that already have it ticked will silently skip it.

The middleware lives at resources/extensions/totalcms/maintenance/MaintenanceMiddleware.php. It checks for an AUTH_USER session attribute to implement the admin bypass. No DI dependencies beyond the request’s session attribute.

Source: resources/extensions/totalcms/maintenance/