Download the PHP package triopsi/maintenance without Composer
On this page you can find all versions of the php package triopsi/maintenance. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package maintenance
Maintenance plugin for CakePHP
A maintenance mode for your CakePHP application. With this plugin you can put your app into maintenance mode. With a whitelist you can also determine who can still access your application. It comes to you with a component, console and middleware.
:warning: This tool should not be used if the DB connection or your application goes down completely due to upgrades. There it would fail hard. It should only be used for soft maintenance work.
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
Load Plugin via bin/bake
Via the load task you are able to load plugins in your application.php. You can do this by running:
Manually Installing
If the plugin you want to install is not available on packagist.org, you can clone or copy the plugin code into your plugins directory. /plugin/
Put this in the application.php in the bootstrap method:
If we were installing the plugin manually you would need to modify our application’s composer.json file to contain the following information:
Additionally, you will need to tell Composer to refresh its autoloading cache:
Customizing
Make sure you have a template file in /templates/Error/
named maintenance.php
.
Configs:
className
: Sets the view classname.Accepts either a short name (Ajax) a plugin name (MyPlugin.Ajax) or a fully namespaced name (App\View\AppView) or null to use the View class provided by CakePHP.templatePath
: Sets path for template file. e.g. /template/Error.statusCode
: HTTP Response Code for the http header.templateLayout
: Layoutname or false for use default layout.templateFileName
: Teamplet name for maintenance mode.templateExtension
: View template extension.contentType
: Response Type. The MIME type of the resource or the data.api_prefix
: API Url Suffix. Maintenance Mode are disable for this prefix. Type false for disable exceptions.
Those can be used to adjust the content of the maintenance mode page.
Maintenance Component
This component adds functionality on top:
- A flash message shows you if you are currently whitelisted in case maintenance mode is active (and you just don't see it due to the whitelisting).
How to setup
Diable the Flash message
Write in the /config/app.php
a variable like:
or in the initialize method in /src/Controller/AppController
:
Instead of a flash message, something else can also be triggered.
A view variable named maintenance_mode
is written in the component. With the help of this variable it is possible to query the status in the template files. This could look something like this:
MaintenanceMode Commands
This should be the preferred way of enabling and disabling the maintenance mode for your application.
Commands
- status
- activate
- deactivate
- whitelist
- reset
Help Page
Examples
Example for activating the maintenance mode:
Or with Timout (5 minutes)
Disable maintenance mode
Or Reset the mode (disable maintenance mode and delete all whitelist ip addresses)
Add ip address in the whitelist
Add ip addresses in the whitelist
Remove a ip address from the whitelist
List all ip addresses
Get status