/** * @param LifecycleEventArgs $eventArgs */ public function preRemove(LifecycleEventArgs $eventArgs) { $entity = $eventArgs->getEntity(); if ($entity instanceof MagentoSoapTransport && $entity->getWsdlUrl()) { $this->wsdlManager->clearCacheForUrl($entity->getWsdlUrl()); } }
/** * {@inheritdoc} */ public function init(Transport $transportEntity) { /** * Cache WSDL and force transport entity to use it instead of original URL. * This should be done before parent::init as settings will be cached there. */ if ($transportEntity instanceof MagentoSoapTransport) { $wsdlUrl = $transportEntity->getWsdlUrl(); // Save auth information to be able to perform requests. $urlParts = parse_url($wsdlUrl); if (isset($urlParts['user'], $urlParts['pass'])) { $this->auth['login'] = $urlParts['user']; $this->auth['password'] = $urlParts['pass']; } // Load WSDL to local cache. if (!$this->wsdlManager->isCacheLoaded($wsdlUrl)) { $this->wsdlManager->loadWsdl($wsdlUrl); } // Set cached WSDL path to transport entity. $transportEntity->setWsdlCachePath($this->wsdlManager->getCachedWsdlPath($wsdlUrl)); } parent::init($transportEntity); $wsiMode = $this->settings->get('wsi_mode', false); $apiUser = $this->settings->get('api_user', false); $apiKey = $this->settings->get('api_key', false); $apiKey = $this->encoder->decryptData($apiKey); if (!$apiUser || !$apiKey) { throw new InvalidConfigurationException("Magento SOAP transport require 'api_key' and 'api_user' settings to be defined."); } // revert initial state $this->isExtensionInstalled = null; $this->adminUrl = null; $this->isWsiMode = $wsiMode; /** @var string sessionId returned by Magento API login method */ $this->sessionId = null; $this->sessionId = $this->call('login', ['username' => $apiUser, 'apiKey' => $apiKey]); $this->checkExtensionFunctions(); }
public function testClearAllWsdlCaches() { $path = $this->manager->getWsdlCachePath(); $this->assertClearCache($path); $this->manager->clearAllWsdlCaches(); }
/** * {@inheritdoc} */ public function clear($cacheDir) { $this->wsdlManager->clearAllWsdlCaches(); }