|
@@ -289,7 +289,11 @@ class Factory
|
|
|
$this->createDefaultInstallers($im, $composer, $io);
|
|
|
|
|
|
if ($fullLoad) {
|
|
|
- $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
|
|
|
+ $globalComposer = null;
|
|
|
+ if (realpath($config->get('home')) !== $cwd) {
|
|
|
+ $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
|
|
|
+ }
|
|
|
+
|
|
|
$pm = $this->createPluginManager($io, $composer, $globalComposer);
|
|
|
$composer->setPluginManager($pm);
|
|
|
|
|
@@ -351,15 +355,11 @@ class Factory
|
|
|
* @param Config $config
|
|
|
* @return Composer|null
|
|
|
*/
|
|
|
- protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins)
|
|
|
+ protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
|
|
|
{
|
|
|
- if (realpath($config->get('home')) === getcwd()) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
$composer = null;
|
|
|
try {
|
|
|
- $composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), false);
|
|
|
+ $composer = self::createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
|
|
|
} catch (\Exception $e) {
|
|
|
if ($io->isDebug()) {
|
|
|
$io->writeError('Failed to initialize global composer: '.$e->getMessage());
|
|
@@ -488,4 +488,16 @@ class Factory
|
|
|
|
|
|
return $factory->createComposer($io, $config, $disablePlugins);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param IOInterface $io IO instance
|
|
|
+ * @param bool $disablePlugins Whether plugins should not be loaded
|
|
|
+ * @return Composer
|
|
|
+ */
|
|
|
+ public static function createGlobal(IOInterface $io, $disablePlugins = false)
|
|
|
+ {
|
|
|
+ $factory = new static();
|
|
|
+
|
|
|
+ return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
|
|
|
+ }
|
|
|
}
|