|
@@ -21,6 +21,7 @@ use Composer\Package\Comparer\Comparer;
|
|
|
use Composer\Package\PackageInterface;
|
|
|
use Composer\Package\Version\VersionParser;
|
|
|
use Composer\Plugin\PluginEvents;
|
|
|
+use Composer\Plugin\PostFileDownloadEvent;
|
|
|
use Composer\Plugin\PreFileDownloadEvent;
|
|
|
use Composer\EventDispatcher\EventDispatcher;
|
|
|
use Composer\Util\Filesystem;
|
|
@@ -140,7 +141,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|
|
->then($accept, $reject);
|
|
|
}
|
|
|
|
|
|
- return $result->then(function ($result) use ($fileName, $checksum, $url) {
|
|
|
+ return $result->then(function ($result) use ($fileName, $checksum, $url, $eventDispatcher) {
|
|
|
// in case of retry, the first call's Promise chain finally calls this twice at the end,
|
|
|
// once with $result being the returned $fileName from $accept, and then once for every
|
|
|
// failed request with a null result, which can be skipped.
|
|
@@ -157,6 +158,11 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
|
|
|
throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url['base'].')');
|
|
|
}
|
|
|
|
|
|
+ if ($eventDispatcher) {
|
|
|
+ $postFileDownloadEvent = new PostFileDownloadEvent(PluginEvents::POST_FILE_DOWNLOAD, $fileName, $checksum, $url['processed']);
|
|
|
+ $eventDispatcher->dispatch($postFileDownloadEvent->getName(), $postFileDownloadEvent);
|
|
|
+ }
|
|
|
+
|
|
|
return $fileName;
|
|
|
});
|
|
|
};
|