protected function InPlaceUpdate::getArchive in Automatic Updates 8
Get an archive with the quasi-patch contents.
Parameters
\Drupal\automatic_updates\UpdateMetadata $metadata: The update metadata.
Return value
\Drupal\Core\Archiver\ArchiverInterface|null The archive or NULL if download fails.
Throws
\SodiumException
1 call to InPlaceUpdate::getArchive()
- InPlaceUpdate::update in src/
Services/ InPlaceUpdate.php - Update a project to the next release.
File
- src/
Services/ InPlaceUpdate.php, line 203
Class
- InPlaceUpdate
- Class to apply in-place updates.
Namespace
Drupal\automatic_updates\ServicesCode
protected function getArchive(UpdateMetadata $metadata) {
$quasi_patch = $this
->getQuasiPatchFileName($metadata);
$url = $this
->buildUrl($metadata
->getProjectName(), $quasi_patch);
$temp_directory = FileSystem::getOsTemporaryDirectory() . DIRECTORY_SEPARATOR;
$destination = $this->fileSystem
->getDestinationFilename($temp_directory . $quasi_patch, FileSystemInterface::EXISTS_REPLACE);
$this
->doGetResource($url, $destination);
$csig_file = $quasi_patch . '.csig';
$csig_url = $this
->buildUrl($metadata
->getProjectName(), $csig_file);
$csig_destination = $this->fileSystem
->getDestinationFilename(FileSystem::getOsTemporaryDirectory() . DIRECTORY_SEPARATOR . $csig_file, FileSystemInterface::EXISTS_REPLACE);
$this
->doGetResource($csig_url, $csig_destination);
$csig = file_get_contents($csig_destination);
$this
->validateArchive($temp_directory, $csig);
return $this->archiveManager
->getInstance([
'filepath' => $destination,
]);
}