Exemplo n.º 1
0
 function _downloadUpgradePackage($product, $upgradeVersion)
 {
     if ($this->isLocalMode($product)) {
         return $this->_downloadUpgradePackageLocal($product, $upgradeVersion);
     }
     $content["service"] = "downloadUpgradePackage";
     $content["args"]["product"] = $product->getFullInfo();
     $content["args"]["newVersion"] = $upgradeVersion;
     $message = "json=" . json_encode($this->buildMessage($content));
     $tmpFile = jaTempnam(ja_sys_get_temp_dir(), 'ja');
     $result = NetworkHelper::downloadFile($tmpFile, $this->getServiceUrl($product), $message);
     $downloadedFile = $result["savePath"];
     if (!JFile::exists($downloadedFile)) {
         //throw new Exception('[UpdaterClient] Fail to download upgrade package', 100);
         jaucRaiseMessage("Error occur when downloading upgrade package!", true);
         return false;
     } else {
         @chmod($downloadedFile, 0644);
         return $downloadedFile;
     }
 }