コード例 #1
0
 private function downloadPluginFromMarketplace($pluginZipTargetFile)
 {
     $this->removeFileIfExists($pluginZipTargetFile);
     $marketplace = new MarketplaceApiClient();
     try {
         $marketplace->download($this->pluginName, $pluginZipTargetFile);
     } catch (\Exception $e) {
         try {
             $downloadUrl = $marketplace->getDownloadUrl($this->pluginName);
             $errorMessage = sprintf('Failed to download plugin from %s: %s', $downloadUrl, $e->getMessage());
         } catch (\Exception $ex) {
             $errorMessage = sprintf('Failed to download plugin: %s', $e->getMessage());
         }
         throw new PluginInstallerException($errorMessage);
     }
 }