Question

There are some nice extensions for Magento developers that you usually do not want to have on a live system.

How can you keep them in the project repository but avoid them to be exposed on a live shop?

Was it helpful?

Solution

There are two relatively new techniques to do it:

  • Use modman so you will be able control by yourself what to deploy for each environment. This means you run modman deploy [name-of-dev-extension] only at your dev environment.

  • Use magento-composer with different composer.json scenarios for different environments. And even easier way is to specify those extensions as dev-modules and then install the project using the --require-dev switch on your development machine.

OTHER TIPS

Those usually can be disabled conveniently with a configuration flag, so they are technically active but not doing anything. If you set this flag to false in app/etc/local.xml of your live system, you should be fine.

See MageTrashApp which was created at the Magento Hackathon in Berlin recently. Allows you to de-activate modules via the admin panel.

A simple way to do this is, is disabling the module in /etc/modules, pushing it, ignore the file locally and enable it again.

I think the best way of dealing with this is either keep all of those modules in the local codePool and disable all local modules on live with this line in your local.xml:

    <disable_local_modules>true</disable_local_modules>

Or you can do "Disable Module Output" in the backend on your live environment. (System -> Configuration -> Advanced). However this doesn't entirely disable the module. But maybe it's just enough of want you want to hide of it.

The only other thing I can think of is write some code that can pull this off. Just check whether it's in developer mode (Mage::getIsDeveloperMode()) and then disable modules. I found some more details on achieving this here: https://stackoverflow.com/questions/6520634/magento-how-to-disable-module-programmatically

I usually just put them into my testing environment, but do not check them into the version control system, for example by using the .gitignore file to exclude them from being considered for committing.

There is a slide in Imagine 2011 conference by Erik Hansen. He stated a code in the slide which is as below ( for developer mode )

# File : index.php
if(preg_match('/^stage\.|\.dev$/', $_SERVER['HTTP_HOST'])) {
   $_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;
}

here is, Erik enabling a setting based on the subdomains which you can customize it yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top