You are here

protected static function InPlaceUpdate::getArchive in Automatic Updates 7

Get an archive with the quasi-patch contents.

Parameters

string $project_name: The project name.

string $from_version: The current project version.

string $to_version: The desired next project version.

Return value

\ArchiverZip The archive.

1 call to InPlaceUpdate::getArchive()
InPlaceUpdate::update in ./InPlaceUpdate.php

File

./InPlaceUpdate.php, line 113

Class

InPlaceUpdate
Class to apply in-place updates.

Code

protected static function getArchive($project_name, $from_version, $to_version) {
  $quasi_patch = self::getQuasiPatchFileName($project_name, $from_version, $to_version);
  $url = self::buildUrl($project_name, $quasi_patch);
  $temp_directory = drupal_realpath('temporary://') . DIRECTORY_SEPARATOR;
  $destination = file_destination($temp_directory . $quasi_patch, FILE_EXISTS_REPLACE);
  self::doGetResource($url, $destination);
  $csig_file = $quasi_patch . '.csig';
  $csig_url = self::buildUrl($project_name, $csig_file);
  $csig_destination = drupal_realpath(file_destination('temporary://' . $csig_file, FILE_EXISTS_REPLACE));
  self::doGetResource($csig_url, $csig_destination);
  $csig = file_get_contents($csig_destination);
  self::validateArchive($temp_directory, $csig);
  if (file_exists($destination)) {
    return new \ArchiverZip($destination);
  }
}