Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7018345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:02:15+00:00 2026-05-27T23:02:15+00:00

I am using zend framework. Sometimes I want to disable or down my site

  • 0

I am using zend framework. Sometimes I want to disable or down my site for specific time for maintenance. So how can I stop people to access any page of my site when needed ?

Where is the bottleneck in Zend Framework where I can stop all requests and stop user to proceed.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:02:16+00:00Added an answer on May 27, 2026 at 11:02 pm

    The tricky part of doing this within the ZF app is that presumably your maintenance will affect the app itself. So, if the app is “broken” during the maintenance, the risk is that an “in-app” solution may break, too. In that sense, “external” approaches like modifying .htaccess or tweaking the public/index.php file are probably more robust.

    However, an “in-app” approach could utilize a front-controller plugin. In application/plugins/TimedMaintenance.php:

    class Application_Plugin_TimedMaintenance extends Zend_Controller_Plugin_Abstract
    {
        protected $start;
        protected $end;
    
        public function __construct($start, $end)
        {
            // Validation to ensure date formats are correct is
            // left as an exercise for the reader. Ha! Always wanted
            // to do that. ;-)
    
            if ($start > $end){
                throw new Exception('Start must precede end');
            }
    
            $this->start = $start;
            $this->end = $end;
        }
    
        public function routeShutdown(Zend_Controller_Request_Abstract $request)
        {
            $now = date('Y-m-d H:i:s');
            if ($this->start <= $now && $now <= $this->end){
                $request->setModuleName('default')
                        ->setControllerName('maintenance')
                        ->setActionName('index');
            }
        }
    }
    

    Then register the plugin in application/Bootstrap.php:

    protected function _initPlugin()
    {
        $this->bootstrap('frontController');
        $front = $this->getResource('frontController');
        $start = '2012-01-15 05:00:00'; 
        $end = '2012-01-15 06:00:00'; 
        $plugin = new Application_Plugin_TimedMaintenance($start, $end);
        $front->registerPlugin($plugin);
    }
    

    In practice, you might want to push the start/end times up to config. In application/configs/application.ini:

    maintenance.enable = true
    maintenance.start = "2012-01-15 05:00:00"
    maintenance.end   = "2012-01-15 06:00:00"
    

    Then you could modify the plugin registration to look like:

    protected function _initPlugin()
    {
        $this->bootstrap('frontController');
        $front = $this->getResource('frontController');
        $config = $this->config['maintenance'];
        if ($config['enable']){
            $start = $config['start']; 
            $end = $config['end'];
            $plugin = new Application_Plugin_TimedMaintenance($start, $end);
            $front->registerPlugin($plugin);
        }
    }
    

    This way, you can enable maintenance mode simply by editing the config entry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using zend framework on windows. I want to implement ajax in my
I am using Zend Framework, I have a layout.phtml which renders navigation.phtml. How can
Using Zend Framework I want to use controllers stored in a directory which is
I'm developing a mobile site using Zend framework, and the site has two possible
I'm using Zend Framework for a miltilingual site. Translating is done with Zend_Translate_Adapter_Gettext. I'm
I'm using the Zend Framework and I want to check that certain fields are
i am using zend framework and i want to know the hour difference between
I am using Zend Framework. Want to make a portlet kind of view, which
I am using Zend Framework. I want the current user (if logged in) to
I am using Zend Framework. I want to fetch record from database without considering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.