Skip to content

Instantly share code, notes, and snippets.

@Nully
Created May 27, 2011 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nully/995582 to your computer and use it in GitHub Desktop.
Save Nully/995582 to your computer and use it in GitHub Desktop.
Zend_Application_Resouce_Maintenance
resources.frontController.plugins[] = "Zend_Controller_Plugin_Maintenance"
; メンテナンスモードで利用するリソースデータ
resources.maintenance.table[] = "xxx.xxx.xxx.xxx/24" ; とか
resources.maintenance.table[] = "xxx.xxx.xxx.xxx/8" ; とか
; ゆくゆくはコントローラ名なども指定したい
; resources.maintenance.controller = "maintenance"
; resources.maintenance.action = "index"
; resources.maintenance.module = "hoge"
<h1>メンテナンス中</h1>
<p>メンテナンスが終わるまで</p>
<pre>
 _人人人人人人人人人人人人人人人_     ,.-‐-、
 >   ゆっくりしていってね!!!   <   /    \
  ̄^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^ ̄  /      \
                            /     _____/\ ,.ヘ
           ,.-‐-、             _/‐'''"" ̄    〉 -7)-〈
           /   \          /         `ー/」l_〉7
          /      \       く  _;;::-‐‐'''"" ̄`"''iヽ、_/」
          /     ______/\ ,.ヘ   〈y'´..、 .,、、ゝ      .',
        _/‐'''"" ̄    〉 -7)-〈   !| __,   、__  `‐、  ,.、 ',
       /          `ー/」l_〉7  ||(rr=-,  r=;ァ'i  | |7}. ',
      く  _;;::-‐''7" ̄ ̄`"'''iヽ、_/」   ||. ̄ ,'  ´ ̄   リ!|/  ',
      〈y'´ .i  |_!_,.ハ  i 、!,_.| |〉     !.',  i,_っ     l!|   ヽ
       ! ヽ.|  |__,.!/ Vレ,、!__!| |     .l ',  ,___,     | l    \
        |   | : rr=-,  r=;ァ'i |     | ヽ 'ー=-'    , ヽヽ    \
       i   | :!'"       "! |     ヽ. ヽ、    ,.ィ   ヽ,
   `ヽ、__,,'   | i|   'ー=-'  ノ| |     /,、ri个`,゙゙゙゙´   //ヽ ,、
   i    /  ヽ、!>,、 _____, ,.イ | | |   .// | ||| | ',',\  / / // /\
</pre>
<?php
/**
* Zend Framework - メンテナンスモードプラグイン
*/
require_once "Zend/Controller/Plugin/Abstract.php";
class Zend_Controller_Plugin_Maintenance
extends Zend_Controller_Plugin_Abstract
{
public function routeShutdown(Zend_Controller_Request_Abstract $request) {
// ここでIP許可リスト内か判別
// 許可リストのものでなければ、以下の処理を行う
$request->setActionName("index")
->setControllerName("maintenance")
->setModuleName("default");
}
}
<?php
class Maintenance_Controller extends Zend_Controller_Action {
public function init() {
// 何かしら初期化
}
// Viewを表示するためだけの空アクション
public function indexAction() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment