[SOLVED] How to programmatically check if a Module is loaded

Question

When we load any module we do




return array(

    ......

    'modules'=>array('forum',...),

    ......

);



in config file.

But how do I programmatically check it if a specific module is loaded.

Why I need it?

I have a module that will be used, and may not be used in different environment. So all I want to do it go into config file and comment or uncomment module import code. And in my app, it will skip the code that belong to that module automatically.

What I do for now

For now, I decide to use “is_null” against the module param order to check if it’s being loaded or not.

When a module is loaded it will be available in Yii::app()->modules. You can write some code to check that? :)

Oh, thanks. Got the idea. This should work.