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
- 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.