Add setProcessedUrl method to PreFileDownloadEvent
parent
9d5051faac
commit
13bdf8553a
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue