Fix disabling plugins which has to happen in the factory now
parent
3e1519cde0
commit
15ac7be6f1
|
@ -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 '.
|
||||
|
|
|
@ -151,7 +151,7 @@ EOT
|
|||
$installedFromVcs = false;
|
||||
}
|
||||
|
||||
$composer = Factory::create($io);
|
||||
$composer = Factory::create($io, null, $disablePlugins);
|
||||
|
||||
if ($noScripts === false) {
|
||||
// dispatch event
|
||||
|
|
|
@ -58,7 +58,12 @@ EOT
|
|||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$composer = $this->getComposer();
|
||||
if ($input->getOption('no-custom-installers')) {
|
||||
$output->writeln('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
||||
$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('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
||||
$input->setOption('no-plugins', true);
|
||||
}
|
||||
if ($input->getOption('no-plugins')) {
|
||||
$install->disablePlugins();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,12 @@ EOT
|
|||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$composer = $this->getComposer();
|
||||
if ($input->getOption('no-custom-installers')) {
|
||||
$output->writeln('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
||||
$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('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
|
||||
$input->setOption('no-plugins', true);
|
||||
}
|
||||
if ($input->getOption('no-plugins')) {
|
||||
$install->disablePlugins();
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue