One of the things that I love to do is to have a maintenance page so when we're doing something that could potentially break the site, like changing the database schema, we can keep the users from using the site until it's ready.  In this vein, it's nice to be able to have a quick way to do this using the Zend Framework.

Creating the Plugin/The Heavy Lifter

This is a really simple process.  Create a new plugin (I'm calling mine Speedy_Plugins_Maintenance because I'm making it part of the Speedy Library) and fill it with the following:

class Speedy_Plugins_Maintenance extends Zend_Controller_Plugin_Abstract{
    public function routeShutdown(Zend_Controller_Request_Abstract $request){ 
        // we only want to run this if the isMaintenance flag is set
        if(is_file(dirname(APPLICATION\_PATH) . '/tmp/inMaintenance')){ 
            $request->setModuleName('default');
            $request->setControllerName('maintenance');
            $request->setActionName('index');
        }
    } 
}

The trick behind this is that we want to be easy to enable and disable so we're going to check for the existence of a file.

Getting This Working in the Application

In your bootstrap.php file add the following:

protected function _initEnablePlugins(){
    $front = Zend_Controller_Front::getInstance();
    $front->registerPlugin(new Speedy_Plugins_Maintenance()); 
}

This will add the Plugin to the Front Controller and run it. The last step is to create the MaintenanceController and the associated .phtml files. They're very bland so I won't go through them here. I would suggest you don't rely on the layout you currently have on the site because it might be inaccessible due to the maintenance.