Performance Optimization – Disable Mage_Reports Module

coreperformancereports

When thinking about optimizing the speed of Magento, there are several possibilities like caching (PHP, Database, even Full Page Caches) to speed up your site.

Another possibility is to reduce the amount of processing which is done, i.e. reduce the number of modules running in your shop.

Recently, I have wondered whether it is possible / safe to deactivate the Mage_Reports module.

This is in the file app/etc/modules/Mage_All.xml as

<Mage_Reports>
    <active>true</active>
    <codePool>core</codePool>
    <depends>
        <Mage_Customer/>
        <Mage_Catalog/>
        <Mage_Sales/>
        <Mage_Cms/>
    </depends>
</Mage_Reports>

So it comes bundled with the core and depends on several other modules.

However,I do not see other modules having Mage_Reports as a dependency.

I deactivated it in a test store and everything seems to run fine.

Question => Is it true, that besides losing the reports data, of course, the store can run well without this module?

Or are there any points at which my store will break when this module is not activated?

Best Answer

Your store might work, that's true, as long as you have admin panel Graphs also disabled. In reality though it's all up to programmers and how they're handling situations with modules being disabled. The issue is, that Magento 1.x does not have a handling mechanism that would automatically solve that problem for you. If you look at

public function getResourceModelInstance($modelClass='', $constructArguments=array())
{
    $factoryName = $this->_getResourceModelFactoryClassName($modelClass);
    if (!$factoryName) {
        return false;
    }
    return $this->getModelInstance($factoryName, $constructArguments);
}

it will return false when module is disabled. Which means all Mage::getModel('reports/.. will be false and whatever method you'll try to call on that (supposed to be) object will throw you a Call to a member function on a non-object php Fatal error.

While Magento team did their job done (well, they didn't actually, if you enable Charts your admin should break on Dashboard for example), you can't know how 3rd party extensions will handle those situations in case they try to use the Reports module.

So, if you make sure you're handling all the situations where reports are called, then you can disable it. Otherwise, better not to.

Related Topic