Skip to content

Instantly share code, notes, and snippets.

@gamort
Created December 20, 2016 20:29
Show Gist options
  • Save gamort/f3237b95fff868aa35b455273f2cb65a to your computer and use it in GitHub Desktop.
Save gamort/f3237b95fff868aa35b455273f2cb65a to your computer and use it in GitHub Desktop.
Modified controller override checker for Magento - only shows actual overrides
<?php
# test.php => (http://mysite.dev/test.php)
ini_set('display_errors',1);
error_reporting(E_ALL^E_STRICT);
include 'app/Mage.php';
Mage::setIsDeveloperMode(true);
Mage::app();
// ===================================================================================================
// SECOND TEST - sniff for controller rewrites
// ===================================================================================================
// you can change 'standard' to 'admin' if you're debugging adminhtml controller rewrites
$router = Mage::app()->getFrontController()->getRouter('standard');
/* @var $router Mage_Core_Controller_Varien_Router_Standard */
$reflection = new ReflectionClass($router);
$modules = $reflection->getProperty('_modules');
$modules->setAccessible(true);
foreach ($modules->getValue($router) as $label => $controllers)
{
if (count($controllers) > 1)
{
echo "For routes beginning with $label possible controllers are\n";
print_r($controllers);
}
}
// ===================================================================================================
// END SECOND TEST - sniff for controller rewrites
// ===================================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment