1
0
Fork 0

Merge remote-tracking branch 'logicalor/create-project-event-dispatcher' into 1.10

pull/9062/head
Jordi Boggiano 2020-07-17 11:44:02 +02:00
commit 1d3af13c22
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 9 additions and 4 deletions

View File

@ -39,6 +39,7 @@ use Composer\Json\JsonFile;
use Composer\Config\JsonConfigSource; use Composer\Config\JsonConfigSource;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\EventDispatcher\EventDispatcher;
/** /**
* Install a package as new project into new directory. * Install a package as new project into new directory.
@ -286,8 +287,12 @@ EOT
$config->merge(array('config' => array('secure-http' => false))); $config->merge(array('config' => array('secure-http' => false)));
} }
$composer = Factory::create($io, $config->all(), $disablePlugins);
$eventDispatcher = $composer->getEventDispatcher();
if (null === $repository) { if (null === $repository) {
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config)); $rm = RepositoryFactory::manager($io, $config, $eventDispatcher, Factory::createRemoteFilesystem($io, $config));
$sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm));
} else { } else {
$sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true); $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
} }
@ -384,7 +389,7 @@ EOT
$package = $package->getAliasOf(); $package = $package->getAliasOf();
} }
$dm = $this->createDownloadManager($io, $config); $dm = $this->createDownloadManager($io, $config, $eventDispatcher);
$dm->setPreferSource($preferSource) $dm->setPreferSource($preferSource)
->setPreferDist($preferDist) ->setPreferDist($preferDist)
->setOutputProgress(!$noProgress); ->setOutputProgress(!$noProgress);
@ -409,11 +414,11 @@ EOT
return $installedFromVcs; return $installedFromVcs;
} }
protected function createDownloadManager(IOInterface $io, Config $config) protected function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher)
{ {
$factory = new Factory(); $factory = new Factory();
return $factory->createDownloadManager($io, $config); return $factory->createDownloadManager($io, $config, $eventDispatcher);
} }
protected function createInstallationManager() protected function createInstallationManager()