8

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?

1
  • 2
    recently viewed products is related to reports Jan 24, 2013 at 18:25

2 Answers 2

3

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.

1
  • 4
    The third party extension should have a <depends> block in their module configuration, so the module throws an error, if you don't have reports enabled. This should be - yea I know... - best practice Jan 25, 2013 at 10:32
2

I can't tell you what will happen if you disable the module but I can tell you how you can (likely) stop its processing impact without disabling it.

All of its processing cost comes from observers. And probably a Xeon job but that isn't relevant here. If you can stop the observing of the events you can eliminate the overhead.

The naive way would be to edit the config.xml and comment them out. Don't do that.

The right way would be to create your own module that depends on Mage_Reports and just have a config.xml. In that define a front end tag and copy in all the observers from Mage_Reports. Then change the event they are observing to some nonsense not real event that will never get fired. Then add a tag under the observer named type with a value of disabled.

If you look in dispatch event in App.php you will be able to see that it works. You overwrite theirs with a disabled observer. Nothing gets called and nothing breaks!

1
  • That sounds like a good idea!
    – mpaepper
    Jan 27, 2013 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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