Beispiel #1
0
 /**
  * @param $downloadPath
  * @return bool
  */
 public function downloadUpdate($downloadPath)
 {
     $et = new Et(static::DownloadUpdate, 240);
     if (IOHelper::folderExists($downloadPath)) {
         $downloadPath .= StringHelper::UUID() . '.zip';
     }
     $et->setDestinationFileName($downloadPath);
     if (($fileName = $et->phoneHome()) !== null) {
         return $fileName;
     }
     return false;
 }
Beispiel #2
0
 /**
  * @param string $downloadPath
  * @param string $md5
  *
  * @return bool
  */
 public function downloadUpdate($downloadPath, $md5)
 {
     if (IOHelper::folderExists($downloadPath)) {
         $downloadPath .= $md5 . '.zip';
     }
     $updateModel = craft()->updates->getUpdates();
     $buildVersion = $updateModel->app->latestVersion . '.' . $updateModel->app->latestBuild;
     $path = 'http://download.buildwithcraft.com/craft/' . $updateModel->app->latestVersion . '/' . $buildVersion . '/Patch/' . $updateModel->app->localBuild . '/' . $md5 . '.zip';
     $et = new Et($path, 240);
     $et->setDestinationFileName($downloadPath);
     if (($fileName = $et->phoneHome()) !== null) {
         return $fileName;
     }
     return false;
 }
 /**
  * @param string $downloadPath
  * @param string $md5
  * @param string $handle
  *
  * @return bool
  */
 public function downloadUpdate($downloadPath, $md5, $handle)
 {
     if (IOHelper::folderExists($downloadPath)) {
         $downloadPath .= $md5 . '.zip';
     }
     $updateModel = craft()->updates->getUpdates();
     $buildVersion = $updateModel->app->latestVersion . '.' . $updateModel->app->latestBuild;
     if ($handle == 'craft') {
         $path = 'http://download.craftcms.com/craft/' . $updateModel->app->latestVersion . '/' . $buildVersion . '/Patch/' . ($handle == 'craft' ? $updateModel->app->localBuild : $updateModel->app->localVersion . '.' . $updateModel->app->localBuild) . '/' . $md5 . '.zip';
     } else {
         $localVersion = null;
         $localBuild = null;
         $latestVersion = null;
         $latestBuild = null;
         foreach ($updateModel->plugins as $plugin) {
             if (strtolower($plugin->class) == $handle) {
                 $parts = explode('.', $plugin->localVersion);
                 $localVersion = $parts[0] . '.' . $parts[1];
                 $localBuild = $parts[2];
                 $parts = explode('.', $plugin->latestVersion);
                 $latestVersion = $parts[0] . '.' . $parts[1];
                 $latestBuild = $parts[2];
                 break;
             }
         }
         $path = 'http://download.craftcms.com/plugins/' . $handle . '/' . $latestVersion . '/' . $latestVersion . '.' . $latestBuild . '/Patch/' . $localVersion . '.' . $localBuild . '/' . $md5 . '.zip';
     }
     $et = new Et($path, 240);
     $et->setDestinationFileName($downloadPath);
     if (($fileName = $et->phoneHome()) !== null) {
         return $fileName;
     }
     return false;
 }