定制 awebdeveloper/cakephp-maintenance-mode 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

awebdeveloper/cakephp-maintenance-mode

Composer 安装命令:

composer require awebdeveloper/cakephp-maintenance-mode

包简介

CakePHP Maintenance Mode

README 文档

README

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.

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.

##Requirement CakePHP 2.*

Installation

[Using Composer]

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:

{
	"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.)

[Manual]

[GIT Submodule]

In your app directory type:

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

[GIT Clone]

In your Plugin directory type:

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

Usage

In your Bootstrap.php add

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

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

Parameters

It supports Following Parameters

  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.

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

    or

    	'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.

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

    or

    	'ip_filters' => '201.201.201.1'
    

For info read the docs on dispatch filter

http://book.cakephp.org/2.0/en/development/dispatch-filters.html

统计信息

  • 总下载量: 8.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 3
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-11-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固