[Tutorial] Maintenance Of Each Controller

I had read an article about maintenance in Yii:


it’s very nice, but the problem here is, I want SiteController still works but NewsController (PollController, …) is maintenance, so how?

This my way, very simple. In file config/main.php:



    'maintenance' => array(

        // configure controller maintenance you want. True is maintenance, not exists or False is not maintenance

	'news' => true 



Now, in file components/Controller.php

class Controller extends CController


   public function init()


      $controllerID = Yii::app()->controller->id;

      if (isset(Yii::app()->params['maintenance'][$controllerID]) 

          && Yii::app()->params['maintenance'][$controllerID] == true) {

          //your code for maintenance





This my way, hope can help you, tks for read my topic