Add setProcessedUrl method to PreFileDownloadEvent
parent
9d5051faac
commit
13bdf8553a
|
@ -127,6 +127,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
||||||
if ($eventDispatcher) {
|
if ($eventDispatcher) {
|
||||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed']);
|
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $httpDownloader, $url['processed']);
|
||||||
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
$eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||||
|
$url['processed'] = $preFileDownloadEvent->getProcessedUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
$checksum = $package->getDistSha1Checksum();
|
$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
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -63,4 +63,14 @@ class PreFileDownloadEvent extends Event
|
||||||
{
|
{
|
||||||
return $this->processedUrl;
|
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) {
|
if ($this->eventDispatcher) {
|
||||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
|
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
|
||||||
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||||
|
$filename = $preFileDownloadEvent->getProcessedUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->httpDownloader->get($filename, $this->options);
|
$response = $this->httpDownloader->get($filename, $this->options);
|
||||||
|
@ -1101,6 +1102,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
if ($this->eventDispatcher) {
|
if ($this->eventDispatcher) {
|
||||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
|
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
|
||||||
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||||
|
$filename = $preFileDownloadEvent->getProcessedUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = $this->options;
|
$options = $this->options;
|
||||||
|
@ -1167,6 +1169,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
if ($this->eventDispatcher) {
|
if ($this->eventDispatcher) {
|
||||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
|
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename);
|
||||||
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||||
|
$filename = $preFileDownloadEvent->getProcessedUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = $lastModifiedTime ? array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime))) : array();
|
$options = $lastModifiedTime ? array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime))) : array();
|
||||||
|
|
Loading…
Reference in New Issue