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 $required
|
||||||
|
* @param bool $disablePlugins
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
public function getComposer($required = true)
|
public function getComposer($required = true, $disablePlugins = false)
|
||||||
{
|
{
|
||||||
if (null === $this->composer) {
|
if (null === $this->composer) {
|
||||||
$application = $this->getApplication();
|
$application = $this->getApplication();
|
||||||
if ($application instanceof Application) {
|
if ($application instanceof Application) {
|
||||||
/* @var $application Application */
|
/* @var $application Application */
|
||||||
$this->composer = $application->getComposer($required);
|
$this->composer = $application->getComposer($required, $disablePlugins);
|
||||||
} elseif ($required) {
|
} elseif ($required) {
|
||||||
throw new \RuntimeException(
|
throw new \RuntimeException(
|
||||||
'Could not create a Composer\Composer instance, you must inject '.
|
'Could not create a Composer\Composer instance, you must inject '.
|
||||||
|
|
|
@ -151,7 +151,7 @@ EOT
|
||||||
$installedFromVcs = false;
|
$installedFromVcs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$composer = Factory::create($io);
|
$composer = Factory::create($io, null, $disablePlugins);
|
||||||
|
|
||||||
if ($noScripts === false) {
|
if ($noScripts === false) {
|
||||||
// dispatch event
|
// dispatch event
|
||||||
|
|
|
@ -58,7 +58,12 @@ EOT
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
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'));
|
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
$install = Installer::create($io, $composer);
|
$install = Installer::create($io, $composer);
|
||||||
|
@ -92,10 +97,6 @@ EOT
|
||||||
->setOptimizeAutoloader($input->getOption('optimize-autoloader'))
|
->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')) {
|
if ($input->getOption('no-plugins')) {
|
||||||
$install->disablePlugins();
|
$install->disablePlugins();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,12 @@ EOT
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
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'));
|
$composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
$install = Installer::create($io, $composer);
|
$install = Installer::create($io, $composer);
|
||||||
|
@ -98,10 +103,6 @@ EOT
|
||||||
->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $input->getArgument('packages'))
|
->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')) {
|
if ($input->getOption('no-plugins')) {
|
||||||
$install->disablePlugins();
|
$install->disablePlugins();
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,14 +165,15 @@ class Application extends BaseApplication
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $required
|
* @param bool $required
|
||||||
|
* @param bool $disablePlugins
|
||||||
* @throws JsonValidationException
|
* @throws JsonValidationException
|
||||||
* @return \Composer\Composer
|
* @return \Composer\Composer
|
||||||
*/
|
*/
|
||||||
public function getComposer($required = true)
|
public function getComposer($required = true, $disablePlugins = false)
|
||||||
{
|
{
|
||||||
if (null === $this->composer) {
|
if (null === $this->composer) {
|
||||||
try {
|
try {
|
||||||
$this->composer = Factory::create($this->io);
|
$this->composer = Factory::create($this->io, null, $disablePlugins);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
if ($required) {
|
if ($required) {
|
||||||
$this->io->write($e->getMessage());
|
$this->io->write($e->getMessage());
|
||||||
|
|
|
@ -177,11 +177,12 @@ class Factory
|
||||||
* @param IOInterface $io IO instance
|
* @param IOInterface $io IO instance
|
||||||
* @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
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @throws \UnexpectedValueException
|
* @throws \UnexpectedValueException
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
public function createComposer(IOInterface $io, $localConfig = null)
|
public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false)
|
||||||
{
|
{
|
||||||
// load Composer configuration
|
// load Composer configuration
|
||||||
if (null === $localConfig) {
|
if (null === $localConfig) {
|
||||||
|
@ -269,7 +270,9 @@ class Factory
|
||||||
$composer->setLocker($locker);
|
$composer->setLocker($locker);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pm->loadInstalledPlugins();
|
if (!$disablePlugins) {
|
||||||
|
$pm->loadInstalledPlugins();
|
||||||
|
}
|
||||||
|
|
||||||
return $composer;
|
return $composer;
|
||||||
}
|
}
|
||||||
|
@ -408,12 +411,13 @@ class Factory
|
||||||
* @param IOInterface $io IO instance
|
* @param IOInterface $io IO instance
|
||||||
* @param mixed $config either a configuration array or a filename to read from, if null it will read from
|
* @param mixed $config either a configuration array or a filename to read from, if null it will read from
|
||||||
* the default filename
|
* the default filename
|
||||||
|
* @param bool $disablePlugins Whether plugins should not be loaded
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
public static function create(IOInterface $io, $config = null)
|
public static function create(IOInterface $io, $config = null, $disablePlugins = false)
|
||||||
{
|
{
|
||||||
$factory = new static();
|
$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\PackageInterface;
|
||||||
use Composer\Package\AliasPackage;
|
use Composer\Package\AliasPackage;
|
||||||
|
use Composer\Plugin\PluginInstaller;
|
||||||
use Composer\Repository\RepositoryInterface;
|
use Composer\Repository\RepositoryInterface;
|
||||||
use Composer\Repository\InstalledRepositoryInterface;
|
use Composer\Repository\InstalledRepositoryInterface;
|
||||||
use Composer\DependencyResolver\Operation\OperationInterface;
|
use Composer\DependencyResolver\Operation\OperationInterface;
|
||||||
|
|
Loading…
Reference in New Issue