Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
![]() |
![]() ![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 60 | All time: 9,778 This week: 282![]() |
Version | License | PHP version | Categories | |||
ez-maintenance 1.0.0 | The PHP License | 5 | PHP 5, Systems administration |
Description | Author | |
This package can be used to check if a site should be put in maintenance mode. |
Utility Library to handle site maintenance situation
If you're using Composer to manage dependencies, you can include the following in your composer.json file:
"require": {
"xiidea/ez-maintenance": "dev-master"
}
Then, after running composer update
or php composer.phar update
, you can
load the class using Composer's autoloading:
require 'vendor/autoload.php';
Otherwise, you can simply require the given autoload.php
file:
require_once 'PATH_TO_LIBRARY/autoload.php';
Then you can just call EzMaintenance\Worker::watch()
In your index.php
(see the example)
Use adapter to detect if we need to serve the maintenance page or not. 3 Types of adapter provided. You can also define your own adapter.
This is the default adapter. it checks for a specific file if exist or not. default path is down. For the following implementation
you will be shown maintenance page if there is a file exists named maintenance.enable
<?php
EzMaintenance\Worker::watch('file', array(
'path' => 'maintenance.enable'
));
Using this adapter you can watch over existence of an environment variable. The maintenance page will be shown if the environment variable is present with specific value.
<?php
EzMaintenance\Worker::watch('env', array(
'var_name' => 'APPLICATION_ENV',
'check_value' => 'down'
));
This is same ad the env adapter. Only difference is it will check for a php constant instead of environment variable.
<?php
EzMaintenance\Worker::watch('const', array(
'var_name' => 'APPLICATION_ENV',
'check_value' => 'down'
));
You can define your own adapter by implementing the EzMaintenance\Adapter\AdapterInterface
Following options are available to customize the behaviour of the library
This option state the interval in second, the system will check for the site status with this interval. default is 5 second.
You can configure a key to override the maintenance mode. This is helpful t test your site normally while others will see maintenance page.
To browse the page in maintenance mode, you just need to pass the override key as query parameter like: http://yourdomain.com/?key={override_key}
If you want to enable maintenance mode when adapter return false, you can set inverse = true
.
You can provide the built-in template name(simple, game, clock) or path to your own template file. All the options will also be available in your template.
You should echo $javascript
in your template file to enable auto status check.
<?php
echo $javascript;
?>
If you are using any of the default template, you can customize the message using this option.
If you find a bug or want to add a feature to EzMaintenance, great! In order to make it easier and quicker for me to verify and merge changes in, it would be amazing if you could follow these few basic steps:
git checkout -b name_of_new_feature_or_bug
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Aux. | Auxiliary script | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.