On 05/05/2011 00:27, Hector Virgen wrote:
You might want to use a front controller plugin to handle this. The plugin
could inspect the route prior to dispatching (using the routeShutdown()
hook) and if the detected module is disabled it could forward the request to
the error controller.

Using a front controller plugin to remove the module was what I was going to do, but that means that rather preventing a module from being bootstraped, I'm only disabling it after it has been bootstraped. I supposed the performance would not make that much difference esp if most modules are enabled. Looking into it, it might be the only practical way for now, but I'd like to consider alternate approaches at least briefly.

Perhaps I can extend: Zend_Controller_Front - the addModuleDirectory method to be specific.

If I omit the following lines from my application.ini file, will calling $front->addModuleDirectory($path) do the same thing:

resources.frontController.moduleDirectory = PATH
resources.modules = ""

AFAIK, the above two lines are responsible for module autoloading. Of course it would be nice to be able to use the application.ini file and just override what ever method is responsible for loading the modules.

addModuleDirectory looks like it iterates over the dirs and adds the modules' controller dir to the front. However, I see nothing about the module's bootstrap. The init method of Zend_Application_Resource_Modules looks like it handles bootstraping the module. From reading Matthew's blog, I understand the bootstraping of the module happens before routing. So perhaps there is more than one method I need to override. I read about how since Zend_Controller_Front is a singleton, it's a bad idea to extend it.

3 questions:

1. Does the resource loader internally call $front->addModuleDirectory($path) for the application.ini line "resources.frontController.moduleDirectory = PATH"?

2. If I prevent a module controller dir from being added in addModuleDirectory, will this prevent bootstraping the module? Or will I need to override another method elsewhere?

3. Is there a way to specify my own front controller class without resorting to overriding the default one (like the setBootstrap method)?

Any advice is welcome! Thanks!

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to