Esempio n. 1
0
 public function init()
 {
     $this->setCacheChecksum(null);
     $saveCache = true;
     if (Mage::app()->useCache('config')) {
         $loaded = $this->loadCache();
         if ($loaded) {
             return $this;
         }
     }
     $mergeWsdl = new Mage_Api_Model_Wsdl_Config_Base();
     $mergeWsdl->setHandler($this->getHandler());
     if (Mage::helper('api/data')->isComplianceWSI()) {
         /**
          * Exclude Mage_Api wsdl xml file because it used for previous version
          * of API wsdl declaration
          */
         $mergeWsdl->addLoadedFile(Mage::getConfig()->getModuleDir('etc', "Mage_Api") . DS . 'wsi.xml');
         $baseWsdlFile = Mage::getConfig()->getModuleDir('etc', "Mage_Api") . DS . 'wsi.xml';
         $this->loadFile($baseWsdlFile);
         Mage::getConfig()->loadModulesConfiguration('wsi.xml', $this, $mergeWsdl);
     } else {
         /**
          * Exclude Mage_Api wsdl xml file because it used for previous version
          * of API wsdl declaration
          */
         $mergeWsdl->addLoadedFile(Mage::getConfig()->getModuleDir('etc', "Mage_Api") . DS . 'wsdl.xml');
         $baseWsdlFile = Mage::getConfig()->getModuleDir('etc', "Mage_Api") . DS . 'wsdl2.xml';
         $this->loadFile($baseWsdlFile);
         Mage::getConfig()->loadModulesConfiguration('wsdl.xml', $this, $mergeWsdl);
     }
     if (Mage::app()->useCache('config')) {
         $this->saveCache(array('config'));
     }
     return $this;
 }
Esempio n. 2
0
 public function init()
 {
     $this->setCacheChecksum(null);
     $saveCache = true;
     // check if local modules are disabled
     $disableLocalModules = (string) $this->getNode('global/disable_local_modules');
     $disableLocalModules = !empty($disableLocalModules) && ('true' === $disableLocalModules || '1' === $disableLocalModules);
     if ($disableLocalModules) {
         /**
          * Reset include path
          */
         $codeDir = AO::getConfig()->getOptions()->getCodeDir();
         $libDir = AO::getConfig()->getOptions()->getLibDir();
         set_include_path(BP . DS . 'app' . DS . 'code' . DS . 'community' . PS . BP . DS . 'app' . DS . 'code' . DS . 'core' . PS . BP . DS . 'lib' . PS . AO::registry('original_include_path'));
     }
     if (AO::isInstalled()) {
         if (AO::app()->useCache('config')) {
             $loaded = $this->loadCache();
             if ($loaded) {
                 return $this;
             }
         }
     }
     $mergeWsdl = new Mage_Api_Model_Wsdl_Config_Base();
     $mergeWsdl->setHandler($this->getHandler());
     $modules = AO::getConfig()->getNode('modules')->children();
     $baseWsdlFile = AO::getConfig()->getModuleDir('etc', "Mage_Api") . DS . 'wsdl2.xml';
     $this->loadFile($baseWsdlFile);
     foreach ($modules as $modName => $module) {
         //            if ($module->is('active') && $modName == 'Mage_Customer') {
         if ($module->is('active') && $modName != 'Mage_Api') {
             if ($disableLocalModules && 'local' === (string) $module->codePool) {
                 continue;
             }
             $wsdlFile = AO::getConfig()->getModuleDir('etc', $modName) . DS . 'wsdl.xml';
             if ($mergeWsdl->loadFile($wsdlFile)) {
                 $this->extend($mergeWsdl, true);
             }
         }
     }
     $this->setWsdlContent($this->_xml->asXML());
     if (AO::app()->useCache('config')) {
         $this->saveCache(array('config'));
     }
     return $this;
 }