mwin007
11/5/2015 - 8:23 AM

Using debug extensions developer mode enough protectionUsing debug extensions developer mode enough protection

Using debug extensions developer mode enough protectionUsing debug extensions developer mode enough protection

Using debug extensions / developer mode enough protection

up vote
15
down vote
favorite
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?

development debug developer-mode
shareimprove this question
edited May 22 at 12:09

7ochem
2,11541340	
asked Jan 25 '13 at 8:54

Alex
5,62232669
add a comment
7 Answers
activeoldestvotes
up vote
18
down vote
accepted
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.

shareimprove this answer
edited Sep 18 '13 at 19:12

answered Jan 25 '13 at 9:25

Tim Bezhashvyly
7,89232055
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. – Tim Bezhashvyly 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 :-) – Tim Bezhashvyly Feb 7 '13 at 17:30 
add a comment
up vote
9
down vote
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.

shareimprove this answer
answered Jan 25 '13 at 9:08

fschmengler
14k12885
  	 	
This is a good solution unless you want to keep your local.xml file in your repo. Which might be a case. – Tim Bezhashvyly Jan 25 '13 at 12:40
  	 	
Great answer - local.xml is usually not in the repo – Alex Jan 25 '13 at 23:04
add a comment
up vote
5
down vote
See MageTrashApp which was created at the Magento Hackathon in Berlin recently. Allows you to de-activate modules via the admin panel.

shareimprove this answer
answered Feb 10 '13 at 7:02

Karen Baker
1,238317
add a comment
up vote
4
down vote
A simple way to do this is, is disabling the module in /etc/modules, pushing it, ignore the file locally and enable it again.

shareimprove this answer
answered Jan 25 '13 at 9:04

Toon Van Dooren
740416
  	 	
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. – Tim Bezhashvyly 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. – Tim Bezhashvyly 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
add a comment
up vote
2
down vote
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: http://stackoverflow.com/questions/6520634/magento-how-to-disable-module-programmatically

shareimprove this answer
edited Jan 25 '13 at 9:06

answered Jan 25 '13 at 9:01

Rick Kuipers
1,8761822
  	 	
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. – Tim Bezhashvyly 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
add a comment
up vote
2
down vote
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.

shareimprove this answer
answered Jan 25 '13 at 11:45

mpaepper
2,6671833
  	 	
OP emphasized on keeping extensions in repository. – Tim Bezhashvyly Jan 25 '13 at 12:34 
add a comment
up vote
0
down vote
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.

shareimprove this answer
answered Jan 26 '13 at 12:42

Oğuz Çelikdemir
54637
  	 	
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
add a comment
Your Answer