carlcs / craft-maintenance
Maintenance plugin for Craft CMS
Installs: 136
Dependents: 0
Suggesters: 0
Security: 0
Stars: 68
Watchers: 2
Forks: 1
Open Issues: 3
Type:craft-plugin
Requires
- php: >=5.3.0
- composer/installers: ~1.0
README
The plugin provides tools to help you do maintenance on your Craft CMS website:
- Display a “Maintenance in progress” overlay in the Control Panel when the site is undergoing scheduled maintenance
- Announce upcoming maintenance on the dashboard and with notification banners
- Leave your users (maintenance related) messages on the dashboard widget
- Access maintenance related info from your templates using the provided template variables
Installation
The plugin is available on Packagist and can be installed using Composer. You can also download the latest release and copy the files into craft/plugins/maintenance/.
$ composer require carlcs/craft-maintenance
Maintenance Announcements
Set up maintenance announcements or messages from the plugin’s settings page. You can use markdown to add links, or to format the message. To configure scheduled maintenance you have to set a start date in the announcement’s settings and enable “Backend Maintenance” and/or “Frontend Maintenance”.
Create a new “Maintenance Announcements” widget to display all notifications on the users’ Dashboards. Upcoming maintenance will also be announced with a banner notification.
Maintenance Modes
Note: the plugin doesn’t do “content freeze” in a way, that it actually prevents data from being saved or changed in the database. That being said, there are template variables and plugins API provided.
Settings
The plugin can be configured from a craft/config/maintenance.php config file or from Settings/Maintenance.
In Settings/Users you can assign user permissions to configure the “Maintenance in progress” overlay or to grant access for individual user groups while frontend maintenance is carried out.
Template Variables
The plugin provides template variables to get the active announcement model, or to check whether the site is currently undergoing maintenance.
isCpMaintenance
Returns whether the Control Panel is currently undergoing maintenance.
{{ isCpMaintenance ? 'Shop closed' : '<a href="/shop">Shop</a>' }}
isSiteMaintenance
Returns whether the site is currently undergoing maintenance.
{% set reason = isSiteMaintenance ? 'scheduled' : 'unscheduled' %}
getAnnouncement( timeInAdvance )
Returns the latest, either currently active or soon to be activated maintenance announcement.
{% set announcement = craft.maintenance.getAnnouncement('2 hours') %} {% if announcement and announcement.blockSite %} <span>{{ announcement.message }}</span> {% endif %}
Planned features
- Quick set up maintenance via environment variable