3

I am trying to extend Enterprise_PageCache_Model_Processor and found that I can do it by making sure that I either modify the enterprise.xml in the app/etc global configs but I wanted to do it in a separate XML file. I got it to work by adding my own file; however, I feel like it might not be the way to go. Since it appears that it just loops through all of the files in the directory, and it appears to do it alphabetically so if you start your file with an "a" it's going to get loaded first and not override.

Is it something that you just have to make sure you name it with a letter after the one you are trying to extend? Do you just modify the XML? What is the ways other people have dealt with this, like if you want to modify config.xml?

4

Doing this through rewrite system isn't possible because in order to provide performance boost, PageCache processor is used very early into request when config object hasn't been initialized yet. Same goes for rewriting all other classes used that early during request lifetime.

You should provide override the same way Magento Enterprise Edition registers it's own processor, through custom app/etc/your_extension.xml file like you mentioned, and rely on the merging of files and the only priority mechanism provided - xmls being loaded alphabetically. This custom file is to be picked up after loading enterprise.xml, file that registers the Enterprise PageCache processor in the first place.

Here's one example:

https://github.com/Marko-M/Inchoo_NewRelic/blob/master/app/etc/inchoo_newrelic.xml

<config>
    [...]
    <global>
        [...]
        <cache>
            <request_processors>
               <ee>[Namespace]_[Module]_Model_Enterprise_Pagecache_Processor</ee>
            </request_processors>
        </cache>
        [...]
    </global>
    [...]
</config>
2

You can overwrite a model from your own extension. Inchoo wrote a nice article on that. Your extensions config.xml would look something like this

<config>
   [...]
    <global>
      [...]
        <models> 
            <pagecache>
                <rewrite>
                    <processor>[Namespace]_[Module]_Model_Processor</processor>
                </rewrite>
            </pagecache>
        </models>
      [...]
    </global>
   [...]
</config>

and your Model file app/code/local/[Namespace]/[Module]/Model/Processor.php something like this

class [Namespace]_[Module]_Model_Processor extends Enterprise_PageCache_Model_Processor
{
   [...]
   your custom methods and extensions go here
   [...]
}
  • I don't think that works for the Pagecache Processor. I had already rewritten the class the way it should, but with Pagecache believe you have to also add to the global config because it doesn't get loaded I believe – dan.codes Feb 19 '14 at 14:00
  • Hm, you could be right. I never tried anything like this. – Sander Mangel Feb 24 '14 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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