diff --git a/src/Composer/Command/Command.php b/src/Composer/Command/Command.php
index 6e91ff869..862b54e58 100644
--- a/src/Composer/Command/Command.php
+++ b/src/Composer/Command/Command.php
@@ -38,16 +38,17 @@ abstract class Command extends BaseCommand
/**
* @param bool $required
+ * @param bool $disablePlugins
* @throws \RuntimeException
* @return Composer
*/
- public function getComposer($required = true)
+ public function getComposer($required = true, $disablePlugins = false)
{
if (null === $this->composer) {
$application = $this->getApplication();
if ($application instanceof Application) {
/* @var $application Application */
- $this->composer = $application->getComposer($required);
+ $this->composer = $application->getComposer($required, $disablePlugins);
} elseif ($required) {
throw new \RuntimeException(
'Could not create a Composer\Composer instance, you must inject '.
diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php
index 308f1d204..c764c9340 100644
--- a/src/Composer/Command/CreateProjectCommand.php
+++ b/src/Composer/Command/CreateProjectCommand.php
@@ -151,7 +151,7 @@ EOT
$installedFromVcs = false;
}
- $composer = Factory::create($io);
+ $composer = Factory::create($io, null, $disablePlugins);
if ($noScripts === false) {
// dispatch event
diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php
index edf8ae593..adc2ca595 100644
--- a/src/Composer/Command/InstallCommand.php
+++ b/src/Composer/Command/InstallCommand.php
@@ -58,7 +58,12 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
- $composer = $this->getComposer();
+ if ($input->getOption('no-custom-installers')) {
+ $output->writeln('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.');
+ $input->setOption('no-plugins', true);
+ }
+
+ $composer = $this->getComposer(true, $input->getOption('no-plugins'));
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
$io = $this->getIO();
$install = Installer::create($io, $composer);
@@ -92,10 +97,6 @@ EOT
->setOptimizeAutoloader($input->getOption('optimize-autoloader'))
;
- if ($input->getOption('no-custom-installers')) {
- $output->writeln('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.');
- $input->setOption('no-plugins', true);
- }
if ($input->getOption('no-plugins')) {
$install->disablePlugins();
}
diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php
index 3ac0e1401..728fadd24 100644
--- a/src/Composer/Command/UpdateCommand.php
+++ b/src/Composer/Command/UpdateCommand.php
@@ -62,7 +62,12 @@ EOT
protected function execute(InputInterface $input, OutputInterface $output)
{
- $composer = $this->getComposer();
+ if ($input->getOption('no-custom-installers')) {
+ $output->writeln('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.');
+ $input->setOption('no-plugins', true);
+ }
+
+ $composer = $this->getComposer(true, $input->getOption('no-plugins'));
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
$io = $this->getIO();
$install = Installer::create($io, $composer);
@@ -98,10 +103,6 @@ EOT
->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $input->getArgument('packages'))
;
- if ($input->getOption('no-custom-installers')) {
- $output->writeln('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.');
- $input->setOption('no-plugins', true);
- }
if ($input->getOption('no-plugins')) {
$install->disablePlugins();
}
diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php
index 0d1e45500..63bb59124 100644
--- a/src/Composer/Console/Application.php
+++ b/src/Composer/Console/Application.php
@@ -165,14 +165,15 @@ class Application extends BaseApplication
/**
* @param bool $required
+ * @param bool $disablePlugins
* @throws JsonValidationException
* @return \Composer\Composer
*/
- public function getComposer($required = true)
+ public function getComposer($required = true, $disablePlugins = false)
{
if (null === $this->composer) {
try {
- $this->composer = Factory::create($this->io);
+ $this->composer = Factory::create($this->io, null, $disablePlugins);
} catch (\InvalidArgumentException $e) {
if ($required) {
$this->io->write($e->getMessage());
diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php
index ae18bee50..28b00fd49 100644
--- a/src/Composer/Factory.php
+++ b/src/Composer/Factory.php
@@ -177,11 +177,12 @@ class Factory
* @param IOInterface $io IO instance
* @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will
* read from the default filename
+ * @param bool $disablePlugins Whether plugins should not be loaded
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @return Composer
*/
- public function createComposer(IOInterface $io, $localConfig = null)
+ public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false)
{
// load Composer configuration
if (null === $localConfig) {
@@ -269,7 +270,9 @@ class Factory
$composer->setLocker($locker);
}
- $pm->loadInstalledPlugins();
+ if (!$disablePlugins) {
+ $pm->loadInstalledPlugins();
+ }
return $composer;
}
@@ -408,12 +411,13 @@ class Factory
* @param IOInterface $io IO instance
* @param mixed $config either a configuration array or a filename to read from, if null it will read from
* the default filename
+ * @param bool $disablePlugins Whether plugins should not be loaded
* @return Composer
*/
- public static function create(IOInterface $io, $config = null)
+ public static function create(IOInterface $io, $config = null, $disablePlugins = false)
{
$factory = new static();
- return $factory->createComposer($io, $config);
+ return $factory->createComposer($io, $config, $disablePlugins);
}
}
diff --git a/src/Composer/Installer/InstallationManager.php b/src/Composer/Installer/InstallationManager.php
index a43acbbda..21b16e2fd 100644
--- a/src/Composer/Installer/InstallationManager.php
+++ b/src/Composer/Installer/InstallationManager.php
@@ -14,6 +14,7 @@ namespace Composer\Installer;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
+use Composer\Plugin\PluginInstaller;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\InstalledRepositoryInterface;
use Composer\DependencyResolver\Operation\OperationInterface;