When use the community pool and when the local pool?

communityWithin Magento, extension-code is maintained in three different pools: The core pool reserved for Magento itself, the community pool for MagentoConnect extensions, and the local pool for local modifications. However, there seems to be some misunderstanding among developers on which pool should be used for which purpose. To clearify.

The core

This is easy to explain: The core pool (located in a physical folder app/code/core) is reserved for Magento itself. In other words, only core developers have business here, and nobody else should make modifications here. Simple as that.

What is MagentoConnect?

MagentoConnect is first of all the website that is used to list third party extensions: Modules can be uploaded to the MagentoConnect site and details can be shared with the public. So the MagentoConnect site is an excellent way for developers to distribute their extension to the community - both free as commercial extensions. In other words, the MagentoConnect site facilitates the distribution of community modules and therefor those modules should be installed in the community pool (a physical folder called app/code/community).

However, MagentoConnect does not equal community. For instance, if we (Yireo) build an extension and offer that module for download on our site, then we are distributing that extension to the community. But we do not neccessarily have to make use of the MagentoConnect site. In other words, there might be a lot more community extensions than there are listed on the MagentoConnect site, and all of them belong in the community pool.

What are local modifications?

If you own your site and make modifications for that site, then those are classified as local modifications and those changes should be made in the app/code/local folder. Also, if you hire a third party developer to do some custom work for you, that belongs in the local pool. If you developer your own modules for your own site, that's again local. But if a third party developer gives you some kind of extension that is used by many other customers, that extension is not local but shared with a (limited) community: That extension belongs again to the community pool.

So what is the fuzz?

The problem here is that many Magento modules are distributed througout the community, but are still installing their files in the local pool (while you understand by know it should actually be the community pool). So what? Well, the problem lies in the architecture of Magento. Everything that exists in Magento can be overwritten - there are some fancy XML-methods to do this, but there's an easier way as well: Copying files from one location to another.

An example: Let's say I want to add Facebook authentication to Magento. Authentication is handled by some kind of PHP-class within the Magento core (so the codepool core) and I need to add my own functions to it. Instead of hacking this PHP-file directly, I can copy that file to the folder app/code/local (because it is only for my own site) and make the modifications on that copy instead of the original file. That's how Magento is supposed to work.

Overrides in Magento

Files in the core pool can be overriden by the community and local pool, files in the community pool can be overriden by the local pool, and the local pool - well, that's where the trail ends: Nothing is able to override the local pool. So if a third party developer hands me an extension and that extension is located in the community pool, I can easily modify that extension by copying files the local pool.

But if a third party extension hands me an extension and that extension is located in the local pool, there's nothing to copy anymore and there is only one way to modify the files: Modify them directly - thus, make a core hack. That's definitely not how Magento is supposed to work.

Rating extensions by looking at their codepool

When we rate Magento extensions for our own purpose, checking the codepool is the very first check we do: If we get our hands on an extension that should be located in the community pool, but it is actually in the local pool, we know one thing for certain: This extension was most likely developed by somebody who did not understand the Magento override-system (something we consider as basic knowledge). And of course, we grow very suspicious when reviewing the rest of the code...

Needless to say, all the Yireo extensions we offer for Magento are located in the community pool, except for the extensions that you will never see.