Tip: Use aliases to quick reference Magento XML config

Published by Christian Münch on

Magento’s merged XML config is very huge but not all parts must be referenced during development. Some parts are really important for debugging.
To do this smart n98-magerun offers the “config:dump” command which prints all the merged XML config at once.
As second parameter you can add an XQuery like argument.

Example:

$ n98-magerun.phar config:dump admin/routers/adminhtml/args/modules

Output:

<?xml version="1.0"?>
<modules>
    <Mage_Index before="Mage_Adminhtml">Mage_Index_Adminhtml</Mage_Index>
    <Mage_Paygate before="Mage_Adminhtml">Mage_Paygate_Adminhtml</Mage_Paygate>
    <Mage_Paypal before="Mage_Adminhtml">Mage_Paypal_Adminhtml</Mage_Paypal>
    <widget before="Mage_Adminhtml">Mage_Widget_Adminhtml</widget>
    <oauth before="Mage_Adminhtml">Mage_Oauth_Adminhtml</oauth>
    <Mage_Authorizenet before="Mage_Adminhtml">Mage_Authorizenet_Adminhtml</Mage_Authorizenet>
    <Mage_Bundle before="Mage_Adminhtml">Mage_Bundle_Adminhtml</Mage_Bundle>
    <captcha>Mage_Captcha_Adminhtml</captcha>
    <Mage_Centinel before="Mage_Adminhtml">Mage_Centinel_Adminhtml</Mage_Centinel>
    <Mage_Compiler before="Mage_Adminhtml">Mage_Compiler_Adminhtml</Mage_Compiler>
    <connect before="Mage_Adminhtml">Mage_Connect_Adminhtml</connect>
    <Mage_Downloadable before="Mage_Adminhtml">Mage_Downloadable_Adminhtml</Mage_Downloadable>
    <importexport before="Mage_Adminhtml">Mage_ImportExport_Adminhtml</importexport>
    <api2 before="Mage_Adminhtml">Mage_Api2_Adminhtml</api2>
    <Mage_PageCache before="Mage_Adminhtml">Mage_PageCache_Adminhtml</Mage_PageCache>
    <currencysymbol>Mage_CurrencySymbol_Adminhtml</currencysymbol>
    <xmlconnect before="Mage_Adminhtml">Mage_XmlConnect_Adminhtml</xmlconnect>
    <moneybookers after="Mage_Adminhtml">Phoenix_Moneybookers</moneybookers>
</modules>

This is very useful to find registered consollers.

If you use it often it’s not practical to enter the complete XML path each time.
For this we have “aliases”.
You can register an alias in your user config.

commands:  
  aliases:        
    - "cf": "cache:flush"
    - "admin-routers": "config:dump admin/routers/adminhtml/args/modules"

This registrates two aliases. The first is a shortcut for the cache clear command. The second one is for our previous example.
Now you can list the config part with this simple call:

$ n98-magerun.phar admin-routers

I hope you like that handy feature!


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.