Add repository instance to Pre/PostFileDownloadEvent metadata
parent
7dd95a768b
commit
9a9c738f23
|
@ -109,7 +109,7 @@ class PostFileDownloadEvent extends Event
|
|||
* Returns the context of this download, if any.
|
||||
*
|
||||
* If this download is of type package, the package object is returned. If
|
||||
* this download is of type metadata, the HTTP response is returned.
|
||||
* this download is of type metadata, an array{response: Response, repository: RepositoryInterface} is returned.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
|
@ -127,6 +127,7 @@ class PreFileDownloadEvent extends Event
|
|||
* Returns the context of this download, if any.
|
||||
*
|
||||
* If this download is of type package, the package object is returned.
|
||||
* If the type is metadata, an array{repository: RepositoryInterface} is returned.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
|
|
|
@ -1086,7 +1086,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
while ($retries--) {
|
||||
try {
|
||||
if ($this->eventDispatcher) {
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata');
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', array('repository' => $this));
|
||||
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||
$filename = $preFileDownloadEvent->getProcessedUrl();
|
||||
}
|
||||
|
@ -1112,7 +1112,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
}
|
||||
|
||||
if ($this->eventDispatcher) {
|
||||
$postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, $sha256, $filename, 'metadata', $response);
|
||||
$postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, $sha256, $filename, 'metadata', array('response' => $response, 'repository' => $this));
|
||||
$this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
|
||||
}
|
||||
|
||||
|
@ -1178,7 +1178,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
while ($retries--) {
|
||||
try {
|
||||
if ($this->eventDispatcher) {
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata');
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', array('repository' => $this));
|
||||
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||
$filename = $preFileDownloadEvent->getProcessedUrl();
|
||||
}
|
||||
|
@ -1195,7 +1195,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
}
|
||||
|
||||
if ($this->eventDispatcher) {
|
||||
$postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', $response);
|
||||
$postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $filename, 'metadata', array('response' => $response, 'repository' => $this));
|
||||
$this->eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
|
||||
$httpDownloader = $this->httpDownloader;
|
||||
if ($this->eventDispatcher) {
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata');
|
||||
$preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->httpDownloader, $filename, 'metadata', array('repository' => $this));
|
||||
$this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
|
||||
$filename = $preFileDownloadEvent->getProcessedUrl();
|
||||
}
|
||||
|
@ -1288,7 +1288,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
|||
}
|
||||
|
||||
if ($eventDispatcher) {
|
||||
$postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $url, 'metadata', $response);
|
||||
$postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, null, null, $url, 'metadata', array('response' => $response, 'repository' => $repo));
|
||||
$eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue