0

I've come across the error page on my dev site for Magento. I know where to locate the report but the problem is I do not have a clue what to do next. I haven't made any changes to the site recently so not sure why this would occur. I am unable to even access the admin side.

This is the error/report I've found:

a:4:{i:0;s:55:"Module "Mage_Newsletter" requires module "Mage_Widget".";i:1;s:926:"#0 /chroot/home/vpwindow/dev.mossyoakgraphics.com/html/app/code/core/Mage/Core/Model/Config.php(849): Mage::throwException('Module "Mage_Ne...')

Any guidance would be greatly appreciated!

2 Answers 2

1

Well the report says that the module Mage_Newsletter requires another module, Mage_Widget. So investigate why Mage_Widget is not loading correctly.

I'd start by looking in app/etc/modules to see if the Mage_Widget.xml is loading.

Then check in the admin section in the configuration area (under advanced I think in System > Configuration) to see if the output from that module has been turned off.

0

Let us look what really happens here. If you look on the activation file of the Mage_Newsleter, you can see that, this module depends upon several other modules.

<Mage_Newsletter>
    <active>true</active>
    <codePool>core</codePool>
    <depends>
        <Mage_Core/>
        <Mage_Customer/>
        <Mage_Eav/>
        <Mage_Widget/>
    </depends>
</Mage_Newsletter>

See the depends part. Those are the core modules Mage_Newsletter depends upon. This means that, Mage_Newsletter needs those modules should load before it gets loaded. The reason is Mage_Newsletter uses those core modules properties somewhere inside them. If they didn't load when Mage_Newsletter processed, then it cannot do its job properly :)

Now let us look where this dependancy of modules get processed. Deep inspection will bring us to Mage_Core_Model_Config::_sortModuleDepends(). The relevant part of this property is shown below

protected function _sortModuleDepends($modules)
{
    foreach ($modules as $moduleName => $moduleProps) {
        $depends = $moduleProps['depends'];
        foreach ($moduleProps['depends'] as $depend => $true) {
            if ($moduleProps['active'] && ((!isset($modules[$depend])) || empty($modules[$depend]['active']))) {
                Mage::throwException(
                    Mage::helper('core')->__('Module "%1$s" requires module "%2$s".', $moduleName, $depend)
                );
            }
            $depends = array_merge($depends, $modules[$depend]['depends']);
        }
        $modules[$moduleName]['depends'] = $depends;
    }
    ....
}

The passing $modules is a big array which is constituted by the files inside app/etc/modules. The files inside in this directory is used to register a module and define their dependency.

Now the function loops through each of the array entry and retrieves its depend part. In order to understand, our Mage_Newsletter entry somewhat look like this.

[Mage_Newsletter] => Array
    (
        [module] => Mage_Newsletter
        [depends] => Array
            (
                [Mage_Core] => 1
                [Mage_Customer] => 1
                [Mage_Eav] => 1
                [Mage_Widget] => 1
            )

        [active] => 1
    )

This means $depends = $moduleProps['depends']; holds this value

[depends] => Array
    (
        [Mage_Core] => 1
        [Mage_Customer] => 1
        [Mage_Eav] => 1
        [Mage_Widget] => 1
    )

Now again function loops through this depend array and checks a condition. This is the most relevant part in our case.

if ($moduleProps['active'] && ((!isset($modules[$depend])) || empty($modules[$depend]['active']))) {
        Mage::throwException(
                Mage::helper('core')->__('Module "%1$s" requires module "%2$s".', $moduleName, $depend)
        );
}

The condition first checks whether out module is active or not. If yes, then it checks another condition. First it checks whether the depending entry is prensent $modules array. If it exist, then it make sure that that entry is currently active or not. If both these condition satisfied, sorting of modules based on dependency will carried out by the function. If any one of the condition fails, it throws an exception.

So in the case of Mage_Widget, the above mentioned condition fails. The reason would be two

  1. An entry correspond to Mage_Widget doesn't exist

The chance for this is very rare. You need to check Mage_Widget.xml is present or not in app/etc/modules.

2.Mage_Widget module is not active

Now open Mage_Widget and check whether it is active or not. If yes, check whether it is disabled through admin side.

 System > Configuration > Advanced > Disable Module Output

Check whether Mage_Widget is disabled there.

2
  • This made so much sense, thank you so much! Site is back up and I'm able to get to the admin. Now I'm starting to get an idea why this may have happened because when I take a look at the site, it's showing the Template Path Hints (red boxes). I tried to disable it through the admin side (system>configuration>developer) and turned off the path hints but nothing is happening. I'll probably have to make some changes in the code to get this to work but thanks again! :)
    – Ang
    Aug 27, 2014 at 13:10
  • checks whether there is any log entry present. var/log.Your application has some serious problems ! that's why such wierd things happens Aug 27, 2014 at 13:16

Your Answer

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

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