Guest User

Untitled

a guest
Feb 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. <?php
  2.  
  3. // enable error reporting to see all useful warnings
  4. error_reporting(E_ALL);
  5. ini_set('display_errors', 1);
  6. if (function_exists('libxml_disable_entity_loader')) {
  7. libxml_disable_entity_loader(false);
  8. }
  9.  
  10. header('Content-type: text/plain');
  11.  
  12. $xmlFiles = array(
  13. 'app/etc/modules/Snowdog_Freshmail.xml',
  14. 'app/code/community/Snowdog/Freshmail/etc/adminhtml.xml',
  15. 'app/code/community/Snowdog/Freshmail/etc/config.xml',
  16. 'app/code/community/Snowdog/Freshmail/etc/system.xml',
  17. 'app/code/community/Snowdog/Freshmail/etc/widget.xml',
  18. );
  19. echo 'Testing files from ' . __DIR__ . PHP_EOL;
  20. foreach ($xmlFiles as $xmlFile) {
  21. echo 'Testing existance of ' . $xmlFile . PHP_EOL;
  22. if (file_exists($xmlFile)) {
  23. echo "\t" . 'Found ' . realpath($xmlFile) . PHP_EOL;
  24. echo "\t\t" . 'Contains # lines ' . count(file($xmlFile)) . PHP_EOL;
  25. $xml = simplexml_load_file($xmlFile);
  26. if ($xml) {
  27. echo "\t\t" . 'Contains proper XML object' . PHP_EOL;
  28. }
  29. } else {
  30. echo "\t" . '!! Not found' . PHP_EOL;
  31. }
  32. }
  33.  
  34. echo PHP_EOL . PHP_EOL;
  35.  
  36. require __DIR__ . '/app/Mage.php';
  37. Mage::app('admin', 'store');
  38.  
  39. $coreHelper = Mage::helper('core');
  40. $enabled = $coreHelper->isModuleEnabled('Snowdog_Freshmail');
  41.  
  42. echo 'Module enabled ' . ($enabled ? 'Yes' : 'No') . PHP_EOL;
  43.  
  44. $menuXml = Mage::getModel('admin/config')->getAdminhtmlConfig()->getNode('menu');
  45. $node = $menuXml->xpath('//snowfreshmail');
  46.  
  47. if (count($node)) {
  48. echo 'Menu nodes exists in config' . PHP_EOL;
  49. } else {
  50. echo '!! Did not found menu nodes' . PHP_EOL;
  51. }
  52.  
  53. echo 'Attempt to instantiate helper class' . PHP_EOL;
  54. $helper = new Snowdog_Freshmail_Helper_Data();
  55. if ($helper) {
  56. echo 'Direct class instantiation successful' . PHP_EOL;
  57. } else {
  58. echo '!! Cannot instantiate helper directly' . PHP_EOL;
  59. }
  60.  
  61. class Mage_Snowfreshmail_Helper_Data extends Mage_Core_Helper_Abstract
  62. {
  63. }
  64.  
  65. ;
  66.  
  67. $helper = Mage::helper('snowfreshmail');
  68. if ($helper instanceof Snowdog_Freshmail_Helper_Data) {
  69. echo 'Factory class instantiation successful' . PHP_EOL;
  70. } else {
  71. echo '!! Cannot instantiate helper via factory' . PHP_EOL;
  72. }
  73.  
  74. $outputEnabled = Mage::helper('snowfreshmail')->isModuleOutputEnabled();
  75. echo 'Module output enabled ' . ($outputEnabled ? 'Yes' : 'No') . PHP_EOL;
  76.  
  77. echo PHP_EOL . PHP_EOL;
  78.  
  79. Mage::reset();
  80. echo 'Retry without cache' . PHP_EOL;
  81. Mage::app('admin', 'store', array('global_ban_use_cache' => true));
  82. Mage::getConfig()->getCache()->setOption('caching', false);
  83.  
  84. $coreHelper = Mage::helper('core');
  85. $enabled = $coreHelper->isModuleEnabled('Snowdog_Freshmail');
  86. $outputEnabled = Mage::helper('snowfreshmail')->isModuleOutputEnabled();
  87.  
  88. echo 'Module enabled ' . ($enabled ? 'Yes' : 'No') . PHP_EOL;
  89. echo 'Module output enabled ' . ($outputEnabled ? 'Yes' : 'No') . PHP_EOL;
  90.  
  91. $menuXml = Mage::getModel('admin/config')->getAdminhtmlConfig()->getNode('menu');
  92. $node = $menuXml->xpath('//snowfreshmail');
  93.  
  94. if (count($node)) {
  95. echo 'Menu nodes exists in config' . PHP_EOL;
  96. } else {
  97. echo '!! Did not found menu nodes' . PHP_EOL;
  98. }
  99.  
  100. $compilerConfig = __DIR__ . '/includes/config.php';
  101. if (file_exists($compilerConfig)) {
  102. include $compilerConfig;
  103. }
  104.  
  105. if (defined('COMPILER_INCLUDE_PATH') || define('COMPILER_COLLECT_PATH')) {
  106. echo '!! Warning compiler enabled';
  107. }
Add Comment
Please, Sign In to add comment