diff --git a/template/.env.example b/template/.env.example index 2f8a563..fbd97d0 100644 --- a/template/.env.example +++ b/template/.env.example @@ -26,6 +26,9 @@ DISABLE_PLUGINS_LOCAL=test/test.php DISABLE_PLUGINS_PREPROD=test/test.php DISABLE_PLUGINS_PRODUCTION=test/test.php +MAINTENANCE_ENABLED=true|false +MAINTENANCE_IPS=127.0.0.1,127.0.0.2 + AUTH_KEY='' SECURE_AUTH_KEY='' LOGGED_IN_KEY='' diff --git a/template/readme.md b/template/readme.md index 86384a4..f5fb044 100644 --- a/template/readme.md +++ b/template/readme.md @@ -87,6 +87,10 @@ Par défaut, tout ce qui se trouve dans les sous-dossiers de `web/wp-content` es ## Fonctionnalités additionnelles +### Activation/Désactivation du mode maintenance via variables d'environnement serveur + +Le MU-plugin [Studiometa maintenance mode](./web/wp-content/mu-plugins/studiometa-maintenance-mode/README.md) permet d'activer le mode maintenance du site. [Voir le readme](./web/wp-content/mu-plugins/studiometa-maintenance-mode/README.md) pour plus d'informations. + ### Désactivation de plugins par environnement Le MU-plugin [Studiometa plugin disabler](./web/wp-content/mu-plugins/studiometa-plugin-disabler/README.md) permet de forcer la désactivation des plugins en fonction de l'environnement. [Voir le readme](./web/wp-content/mu-plugins/studiometa-plugin-disabler/README.md) pour plus d'informations. diff --git a/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/README.md b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/README.md new file mode 100644 index 0000000..340fc67 --- /dev/null +++ b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/README.md @@ -0,0 +1,14 @@ +# Studio Meta maintenance mode + +Put your site under maintenance depends on server environment variables. + +## Usage + +1. The following server environment variables must be set in order to the maintenance be active: +```bash +MAINTENANCE_ENABLED=true|false # Enable/Disable maitenance mode. +MAINTENANCE_IPS=42.42.42.42.42 # Exclude a list of IPs from maitenance. +``` +2. You can customize the maintenance page by adding a `maintenance.php` file in `WP_CONTENT_DIR` (see https://developer.wordpress.org/reference/functions/wp_maintenance/). You can find a maintenance page example in [this folder](`./example/maintenance.php`) + +> If you use a cache plugin, don't forget to clean caches. diff --git a/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/example/maintenance.css b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/example/maintenance.css new file mode 100644 index 0000000..5ce768c --- /dev/null +++ b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/example/maintenance.css @@ -0,0 +1 @@ +h1 { color: red; } diff --git a/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/example/maintenance.php b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/example/maintenance.php new file mode 100644 index 0000000..848458e --- /dev/null +++ b/template/web/wp-content/mu-plugins/studiometa-maintenance-mode/example/maintenance.php @@ -0,0 +1,24 @@ + + + +> +
+ + +