Skip to content

Instantly share code, notes, and snippets.

@renepenner
Created January 10, 2018 10:02
Show Gist options
  • Save renepenner/aa169370d6df21333c13aa4d22b4bcc5 to your computer and use it in GitHub Desktop.
Save renepenner/aa169370d6df21333c13aa4d22b4bcc5 to your computer and use it in GitHub Desktop.
check all magento xml
<?php
require_once('./app/Mage.php');
umask(0);
Mage::app();
// enable user error handling
libxml_use_internal_errors(true);
$root = './app';
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD
);
foreach ($iterator as $path => $item) {
if ($item->isFile() && $item->getExtension() == 'xml') {
$xml = simplexml_load_file($path);
foreach (libxml_get_errors() as $error) {
Mage::log($error);
echo '<pre>';
print_r($error);
echo '</pre>';
}
libxml_clear_errors();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment