2017 © Pedro Peláez
 

cakephp-plugin cakephp-maintenance-mode

CakePHP Maintenance Mode

image

awebdeveloper/cakephp-maintenance-mode

CakePHP Maintenance Mode

  • Sunday, December 28, 2014
  • by awebdeveloper
  • Repository
  • 3 Watchers
  • 21 Stars
  • 241 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Cakephp Maintenance Mode

CakePHP Maintenance Mode is to put your website in maintenance mode while you do your upgrade. Most ppl would add a static file on the server and route all request to it during maintenance. The file is shown to everybody including you unless a rewrite rule or expressions is added to exclude yourself which would complicate the matter., (*1)

This filter file would tell CakePHP to put all requests to maintenance mode i.e show a msg but would allow requests from your IPs to be processed normally., (*2)

Requirement

CakePHP 2.*, (*3)

Installation

[Using Composer], (*4)

View on Packagist, and copy the JSON snippet for the latest version into your project's composer.json. Eg, v. 1.2.0 would look like this:, (*5)

{
    "require": {
        "awebdeveloper/cakephp-maintenance-mode": "1.2.0"
    }
}

Because this plugin has the type cakephp-plugin set in it's own composer.json, composer knows to install it inside your /Plugin directory, rather than in the usual vendor directory. It is recommended that you add /Plugin/MaintenanceMode to your .gitignore file. (Why? Read this.), (*6)

[Manual], (*7)

[GIT Submodule], (*8)

In your app directory type:, (*9)

git submodule add -b master git://github.com/awebdeveloper/cakephp-maintenance-mode.git Plugin/MaintenanceMode
git submodule init
git submodule update

[GIT Clone], (*10)

In your Plugin directory type:, (*11)

git clone -b master git://github.com/awebdeveloper/cakephp-maintenance-mode.git MaintenanceMode

Usage

In your Bootstrap.php add, (*12)

Configure::write('MaintenanceMode', array(
    'enabled' => true,
    'view' =>   array(
        'layout' => '',
        'template' => 'MaintenanceMode/index'
    ),
    'ip_filters' => array('127.0.*.*')
));

Also in the same file find the below code and add this line, (*13)

Configure::write('Dispatcher.filters', array(
    'AssetDispatcher',
    'CacheDispatcher',
    'MaintenanceMode.MaintenanceMode' ## this line 
));

Parameters

It supports Following Parameters, (*14)

  1. enabled set this to true to enable it
  2. view this is a array that accepts the template and the layout. If layout key is absent it will use the default layout., (*15)

        'view' =>   array(
            'template' => 'Pages/index'
        ),
    

    or, (*16)

        'view' =>   array(
            'layout' => 'main',
            'template' => 'MaintenanceMode/index'
        ),
    
  3. ip_filters this is either a string containing a single IP or an array containing multiple IPs for which maintainance mode will NOT be applied., (*17)

        'ip_filters' => array('127.0.*.*','201.201.201.1')
    

    or, (*18)

        'ip_filters' => '201.201.201.1'
    

For info read the docs on dispatch filter, (*19)

http://book.cakephp.org/2.0/en/development/dispatch-filters.html, (*20)

The Versions

28/12 2014

dev-master

9999999-dev http://github.com/awebdeveloper/cakephp-maintenance-mode

CakePHP Maintenance Mode

  Sources   Download

MIT

The Requires

 

maintenance cakephp dispatcher