Exemplo n.º 1
0
 /**
  * Checks which edition is used
  * @return int
  */
 public static function getPlatform()
 {
     if (self::$_platform == -1) {
         $pathToClaim = BP . DS . "app" . DS . "etc" . DS . "modules" . DS . self::ENTERPRISE_DETECT_COMPANY . "_" . self::ENTERPRISE_DETECT_EXTENSION . ".xml";
         $pathToEEConfig = BP . DS . "app" . DS . "code" . DS . "core" . DS . self::ENTERPRISE_DETECT_COMPANY . DS . self::ENTERPRISE_DETECT_EXTENSION . DS . "etc" . DS . "config.xml";
         $isCommunity = !file_exists($pathToClaim) || !file_exists($pathToEEConfig);
         if ($isCommunity) {
             self::$_platform = self::CE_PLATFORM;
         } else {
             $_xml = @simplexml_load_file($pathToEEConfig, 'SimpleXMLElement', LIBXML_NOCDATA);
             if (!$_xml === FALSE) {
                 $package = (string) $_xml->default->design->package->name;
                 $theme = (string) $_xml->install->design->theme->default;
                 $skin = (string) $_xml->stores->admin->design->theme->skin;
                 $isProffessional = $package == self::PROFESSIONAL_DESIGN_NAME && $theme == self::PROFESSIONAL_DESIGN_NAME && $skin == self::PROFESSIONAL_DESIGN_NAME;
                 if ($isProffessional) {
                     self::$_platform = self::PE_PLATFORM;
                     return self::$_platform;
                 }
                 self::$_platform = self::EE_PLATFORM;
                 return self::$_platform;
             }
             self::$_platform = self::EE_PLATFORM;
         }
     }
     return self::$_platform;
 }
Exemplo n.º 2
0
 public function checkExtensions()
 {
     $modules = array_keys((array) Mage::getConfig()->getNode('modules')->children());
     sort($modules);
     $magentoPlatform = CommerceLab_News_Helper_Versions::getPlatform();
     foreach ($modules as $extensionName) {
         if (strstr($extensionName, 'CommerceLab_') === false) {
             continue;
         }
         if ($extensionName == 'CommerceLab_Core' || $extensionName == 'CommerceLab_All') {
             continue;
         }
         if ($platformNode = $this->getExtensionPlatform($extensionName)) {
             $extensionPlatform = CommerceLab_News_Helper_Versions::convertPlatform($platformNode);
             if ($extensionPlatform < $magentoPlatform) {
                 $this->disableExtensionOutput($extensionName);
                 Mage::getSingleton('adminhtml/session')->addError(Mage::helper('clnews')->__('Platform version is not correct for News module!'));
                 return;
             }
         }
     }
     return $this;
 }