I am trying to override
Mage/Core/Model/Domainpolicy.php
Currently I have done it successfully by copying it to:
app/code/local/Mage/Core/Model/Domainpolicy.php
and added my modifications. That works fine.
But instead I would prefer to have it in my own module which is structured as follows:
app/code/local/Me/Mymodule/
and in its config.xml I have:
<?xml version="1.0"?>
<config>
<modules>
<Me_Mymodule>
<version>0.1</version>
</Me_Mymodule>
</modules>
<global>
<models>
<core>
<rewrite>
<domainpolicy>Me_Mymodule_Core_Model_Domainpolicy</domainpolicy>
</rewrite>
</core>
<reports_resource>
<rewrite>
<helper_mysql4>Me_Mymodule_Reports_Model_Resource_Helper_Mysql4</helper_mysql4>
</rewrite>
</reports_resource>
</models>
<blocks>
<page>
<rewrite>
<html_head>Me_Mymodule_Page_Block_Html_Head</html_head>
</rewrite>
</page>
</blocks>
</global>
<frontend>
<routers>
<contacts>
<args>
<modules>
<Me_Mymodule before="Mage_Contacts">Me_Mymodule_Contacts</Me_Mymodule>
</modules>
</args>
</contacts>
</routers>
</frontend>
</config>
In app/code/local/Me/Mymodule/Core/Model/Domainpolicy.php
I have:
class Me_Mymodule_Core_Model_Domainpolicy extends Mage_Core_Model_Domainpolicy
and the original original code with my modifications applied in one of the functions (I just add a few HTTP headers to the original content policy, no any big changes).
The problem is that when I move the modified Domainpolicy.php
inside my module and extend the original class as shown (and it is no longer in app/code/local/Mage
) Magento doesn't use it but runs the original one (from app/code/core
). At the same time all other things which you see I have overriden in the same module work as expected.
What am I missing?