18

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?

20

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.

  • 1
    + one for reffering to modman :) nice option – Toon Van Dooren Jan 25 '13 at 9:44
  • Can you describe more how that environment-specific deployment would look like? I mean where do I keep the list of modules I deploy? Usually I have a folder of all the modules - and so again I have to separate live and development. – Alex Jan 25 '13 at 23:06
  • @Alex: please see my edit. – user487772 Feb 7 '13 at 15:05
  • @Tim: thanks! I also edited your answer now. – Alex Feb 7 '13 at 17:23
  • @Alex: Thanks. I didn't knew this :-) – user487772 Feb 7 '13 at 17:30
10

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.

  • This is a good solution unless you want to keep your local.xml file in your repo. Which might be a case. – user487772 Jan 25 '13 at 12:40
  • Great answer - local.xml is usually not in the repo – Alex Jan 25 '13 at 23:04
6

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

5

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

  • In this case you will be limited on making modifications to extensions bootstrap file (for instance modifying dependencies). Also if you will check out let's say on your other machine you will have to make al those tricks once again. Might be even more inconvenient with a team of several developers. – user487772 Jan 25 '13 at 12:38
  • If you ignore the file locally the only thing other devs have to do is enable it again. This takes only a few seconds imho. – Toon Van Dooren Jan 25 '13 at 15:20
  • Right. But then they again have to ignore it locally. And this is for each extension for each working copy. I mean your solution will definitely work but is a bit inconvenient. – user487772 Jan 25 '13 at 15:40
  • true, i guess i just looked at it from my position, i usually integrate only 1 or 2 dev tools :-) – Toon Van Dooren Jan 25 '13 at 16:42
3

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

  • All 3 solutions are not good enough. Disabling local modules will force you to move all other modules from local codePool into community and also do it for all future extensions. Disabling modules output as you said still lets extension run slowing down your store. And the 3rd solution will require modifications that will be overwritten with extension(s) update. – user487772 Jan 25 '13 at 12:44
  • 2
    @Tim I agree, absolutely. There should be a better way of dealing with this, there should be a core configuration of disabling/enabling modules when in develop mode. – Rick Kuipers Jan 25 '13 at 12:48
3

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.

  • OP emphasized on keeping extensions in repository. – user487772 Jan 25 '13 at 12:34
1

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.

  • what does this have to do with modules for development? – Bryan Ruiz Jan 28 '13 at 4:11
  • Dear @bryan_ruiz, the Magento system checking the MAGE_IS_DEVELOPER_MODE whether active or not. Check Alan's article. Magento Developer Mode – Oğuz Çelikdemir Jan 28 '13 at 6:26
  • what im saying is i dont understand how this relates to the question. developer mode wont enable or disable the modules he is using. – Bryan Ruiz Jan 28 '13 at 6:50
  • Bryan, as I specified in my comment, you can customize the code that as your request. Of course, raw idea doesn't fit of the request. For instance, if you written your extension depends on a parameter, you can check or control above snippet! – Oğuz Çelikdemir Jan 28 '13 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.