public function yamlDecoder($string) { return Zend_Config_Yaml::decode($string); }
/** * Check for missing files. * @return Dotdigitalgroup_Email_Model_Adminhtml_Dashboard_Content */ public function missingFiles() { $resultContent = Mage::getModel('ddg_automation/adminhtml_dashboard_content'); $resultContent->setStyle(self::CONNECTOR_DASHBOARD_PASSED)->setTitle('Missing Files : ')->setMessage('Looks Great.'); $filePath = Mage::getModuleDir('etc', Dotdigitalgroup_Email_Helper_Config::MODULE_NAME) . DS . 'files.yaml'; $config = Zend_Config_Yaml::decode(file_get_contents($filePath)); /** * Code dirs. */ $etcDir = Mage::getModuleDir('etc', Dotdigitalgroup_Email_Helper_Config::MODULE_NAME); $controllerDir = Mage::getModuleDir('controllers', Dotdigitalgroup_Email_Helper_Config::MODULE_NAME); $sqlDir = Mage::getModuleDir('sql', Dotdigitalgroup_Email_Helper_Config::MODULE_NAME); $localeDir = Mage::getBaseDir('locale'); $rootDir = Mage::getModuleDir('', Dotdigitalgroup_Email_Helper_Config::MODULE_NAME); $blockDir = $rootDir . DS . 'Block'; $helperDir = $rootDir . DS . 'Helper'; $modelDir = $rootDir . DS . 'Model'; /** * Design dir. */ $designDir = Mage::getBaseDir('design'); /** * Skin dir. */ $skinDir = Mage::getBaseDir('skin'); /** * Js dir */ $jsDir = Mage::getBaseDir('base') . DS . 'js'; /** * lib dir */ $libDir = Mage::getBaseDir('lib'); $filesToCheck = array($config['etc'], $config['controllers'], $config['sql'], $config['locale'], $config['block'], $config['helper'], $config['model'], $config['design'], $config['skin'], $config['lib'], $config['js']); $pathToCheck = array($etcDir, $controllerDir, $sqlDir, $localeDir, $blockDir, $helperDir, $modelDir, $designDir, $skinDir, $libDir, $jsDir); foreach ($filesToCheck as $subdir) { foreach ($subdir as $path) { $file = $pathToCheck[0] . DS . str_replace('#', DS, $path); if (!file_exists($file)) { $resultContent->setStyle(self::CONNECTOR_DASHBOARD_FAILED)->setMessage('')->setHowto('File not found : ' . $file); } } array_shift($pathToCheck); } return $resultContent; }