定制 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

awebdeveloper/cakephp-maintenance-mode 适用场景与选型建议

awebdeveloper/cakephp-maintenance-mode 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.09k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2014 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cakephp」 「dispatcher」 「maintenance」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 awebdeveloper/cakephp-maintenance-mode 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 awebdeveloper/cakephp-maintenance-mode 我们能提供哪些服务?
定制开发 / 二次开发

基于 awebdeveloper/cakephp-maintenance-mode 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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