Fix bug when installing
parent
cf9d5f637b
commit
90a29c127f
|
@ -187,12 +187,12 @@ class Factory
|
||||||
* @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will
|
* @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will
|
||||||
* read from the default filename
|
* read from the default filename
|
||||||
* @param bool $disablePlugins Whether plugins should not be loaded
|
* @param bool $disablePlugins Whether plugins should not be loaded
|
||||||
* @param bool $minimalLoad Whether to initialize everything or only main project stuff (used when loading the global composer)
|
* @param bool $fullLoad Whether to initialize everything or only main project stuff (used when loading the global composer)
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @throws \UnexpectedValueException
|
* @throws \UnexpectedValueException
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $minimalLoad = false)
|
public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $fullLoad = true)
|
||||||
{
|
{
|
||||||
// load Composer configuration
|
// load Composer configuration
|
||||||
if (null === $localConfig) {
|
if (null === $localConfig) {
|
||||||
|
@ -241,7 +241,7 @@ class Factory
|
||||||
$composer = new Composer();
|
$composer = new Composer();
|
||||||
$composer->setConfig($config);
|
$composer->setConfig($config);
|
||||||
|
|
||||||
if (!$minimalLoad) {
|
if ($fullLoad) {
|
||||||
// load auth configs into the IO instance
|
// load auth configs into the IO instance
|
||||||
$io->loadConfiguration($config);
|
$io->loadConfiguration($config);
|
||||||
|
|
||||||
|
@ -270,10 +270,7 @@ class Factory
|
||||||
$im = $this->createInstallationManager();
|
$im = $this->createInstallationManager();
|
||||||
$composer->setInstallationManager($im);
|
$composer->setInstallationManager($im);
|
||||||
|
|
||||||
// add installers to the manager
|
if ($fullLoad) {
|
||||||
$this->createDefaultInstallers($im, $composer, $io);
|
|
||||||
|
|
||||||
if (!$minimalLoad) {
|
|
||||||
// initialize download manager
|
// initialize download manager
|
||||||
$dm = $this->createDownloadManager($io, $config, $dispatcher);
|
$dm = $this->createDownloadManager($io, $config, $dispatcher);
|
||||||
$composer->setDownloadManager($dm);
|
$composer->setDownloadManager($dm);
|
||||||
|
@ -283,6 +280,9 @@ class Factory
|
||||||
$composer->setAutoloadGenerator($generator);
|
$composer->setAutoloadGenerator($generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add installers to the manager (must happen after download manager is created since they read it out of $composer)
|
||||||
|
$this->createDefaultInstallers($im, $composer, $io);
|
||||||
|
|
||||||
$globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
|
$globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
|
||||||
$globalRepository = $globalComposer ? $globalComposer->getRepositoryManager()->getLocalRepository() : null;
|
$globalRepository = $globalComposer ? $globalComposer->getRepositoryManager()->getLocalRepository() : null;
|
||||||
$pm = $this->createPluginManager($composer, $io, $globalRepository);
|
$pm = $this->createPluginManager($composer, $io, $globalRepository);
|
||||||
|
@ -296,7 +296,7 @@ class Factory
|
||||||
}
|
}
|
||||||
|
|
||||||
// init locker if possible
|
// init locker if possible
|
||||||
if (!$minimalLoad && isset($composerFile)) {
|
if ($fullLoad && isset($composerFile)) {
|
||||||
$lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
|
$lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
|
||||||
? substr($composerFile, 0, -4).'lock'
|
? substr($composerFile, 0, -4).'lock'
|
||||||
: $composerFile . '.lock';
|
: $composerFile . '.lock';
|
||||||
|
@ -338,7 +338,7 @@ class Factory
|
||||||
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json')));
|
$rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Config $config
|
* @param Config $config
|
||||||
* @return Composer|null
|
* @return Composer|null
|
||||||
*/
|
*/
|
||||||
|
@ -352,7 +352,7 @@ class Factory
|
||||||
$composer = null;
|
$composer = null;
|
||||||
chdir($config->get('home'));
|
chdir($config->get('home'));
|
||||||
try {
|
try {
|
||||||
$composer = self::createComposer($io, null, $disablePlugins, true);
|
$composer = self::createComposer($io, null, $disablePlugins, false);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
}
|
}
|
||||||
chdir($oldCwd);
|
chdir($oldCwd);
|
||||||
|
|
Loading…
Reference in New Issue