1
0
Fork 0

Add setProcessedUrl method to PreFileDownloadEvent

pull/8975/head
Fränz Friederes 2020-06-11 21:53:31 +02:00
parent 9d5051faac
commit 13bdf8553a
No known key found for this signature in database
GPG Key ID: 583D205C93C01BC0
3 changed files with 15 additions and 1 deletions

View File

@ -127,6 +127,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
if ($eventDispatcher) {
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed']);
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
$url['processed'] = $preFileDownloadEvent->getProcessedUrl();
}
$checksum = $package->getDistSha1Checksum();

View File

@ -55,7 +55,7 @@ class PreFileDownloadEvent extends Event
}
/**
* Retrieves the processed URL this remote filesystem will be used for
* Retrieves the processed URL that will be downloaded
*
* @return string
*/
@ -63,4 +63,14 @@ class PreFileDownloadEvent extends Event
{
return $this->processedUrl;
}
/**
* Sets the processed URL that will be downloaded
*
* @return string
*/
public function setProcessedUrl($processedUrl)
{
$this->processedUrl = $processedUrl;
}
}

View File

@ -1015,6 +1015,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
if ($this->eventDispatcher) {
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
$filename = $preFileDownloadEvent->getProcessedUrl();
}
$response = $this->httpDownloader->get($filename, $this->options);
@ -1101,6 +1102,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
if ($this->eventDispatcher) {
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
$filename = $preFileDownloadEvent->getProcessedUrl();
}
$options = $this->options;
@ -1167,6 +1169,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
if ($this->eventDispatcher) {
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
$filename = $preFileDownloadEvent->getProcessedUrl();
}
$options = $lastModifiedTime ? array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime))) : array();