loadCache('aw_all_extensions_feed')) || (time() - Mage::app()->loadCache('aw_all_extensions_feed_lastcheck')) > Mage::getStoreConfig('awall/feed/check_frequency')) { $this->refresh(); } } public function refresh() { $exts = array(); try { $Node = $this->getFeedData(); if (!$Node) return false; foreach ($Node->children() as $ext) { $exts[(string)$ext->name] = array( 'display_name' => (string)$ext->display_name, 'version' => (string)$ext->version, 'url' => (string)$ext->url ); } Mage::app()->saveCache(serialize($exts), 'aw_all_extensions_feed'); Mage::app()->saveCache(time(), 'aw_all_extensions_feed_lastcheck'); return true; } catch (Exception $E) { return false; } } public function checkExtensions() { $modules = array_keys((array)Mage::getConfig()->getNode('modules')->children()); sort($modules); $magentoPlatform = AW_All_Helper_Versions::getPlatform(); foreach ($modules as $extensionName) { if (strstr($extensionName, 'AW_') === false) { continue; } if ($extensionName == 'AW_Core' || $extensionName == 'AW_All') { continue; } if ($platformNode = $this->getExtensionPlatform($extensionName)) { $extensionPlatform = AW_All_Helper_Versions::convertPlatform($platformNode); if ($extensionPlatform < $magentoPlatform) { $this->disableExtensionOutput($extensionName); } } } return $this; } public function getExtensionPlatform($extensionName) { try { if ($platform = Mage::getConfig()->getNode("modules/$extensionName/platform")) { $platform = strtolower($platform); return $platform; } else { throw new Exception(); } } catch (Exception $e) { return false; } } public function disableExtensionOutput($extensionName) { $coll = Mage::getModel('core/config_data')->getCollection(); $coll->getSelect()->where("path='advanced/modules_disable_output/$extensionName'"); $i = 0; foreach ($coll as $cd) { $i++; $cd->setValue(1)->save(); } if ($i == 0) { Mage::getModel('core/config_data') ->setPath("advanced/modules_disable_output/$extensionName") ->setValue(1) ->save(); } return $this; } }