1
0
Fork 0

Fix build regressions

pull/10933/head
Jordi Boggiano 2022-07-05 16:22:29 +02:00
parent 3764073b43
commit 9a6d63f0f4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
4 changed files with 9 additions and 2 deletions

View File

@ -413,6 +413,9 @@ class Factory
$locker = new Package\Locker($io, new JsonFile($config->get('lock') ? $lockFile : Platform::getDevNull(), null, $io), $im, file_get_contents($composerFile), $process); $locker = new Package\Locker($io, new JsonFile($config->get('lock') ? $lockFile : Platform::getDevNull(), null, $io), $im, file_get_contents($composerFile), $process);
$composer->setLocker($locker); $composer->setLocker($locker);
} elseif ($composer instanceof Composer) {
$locker = new Package\Locker($io, new JsonFile(Platform::getDevNull(), null, $io), $im, json_encode($localConfig), $process);
$composer->setLocker($locker);
} }
if ($composer instanceof Composer) { if ($composer instanceof Composer) {

View File

@ -50,7 +50,7 @@ class PluginInstaller extends LibraryInstaller
{ {
// fail install process early if it going to fail due to a plugin not being allowed // fail install process early if it going to fail due to a plugin not being allowed
if ($type === 'install' || $type === 'update') { if ($type === 'install' || $type === 'update') {
$this->composer->getPluginManager()->isPluginAllowed($package->getName(), false); $this->getPluginManager()->isPluginAllowed($package->getName(), false);
} }
return parent::prepare($type, $package, $prevPackage); return parent::prepare($type, $package, $prevPackage);

View File

@ -77,7 +77,7 @@ class PluginManager
$this->versionParser = new VersionParser(); $this->versionParser = new VersionParser();
$this->disablePlugins = $disablePlugins; $this->disablePlugins = $disablePlugins;
$this->allowPluginRules = $this->parseAllowedPlugins($composer->getConfig()->get('allow-plugins'), $composer->getLocker()); $this->allowPluginRules = $this->parseAllowedPlugins($composer->getConfig()->get('allow-plugins'), $composer->getLocker());
$this->allowGlobalPluginRules = $this->parseAllowedPlugins($globalComposer !== null ? $globalComposer->getConfig()->get('allow-plugins') : false, $globalComposer !== null ? $globalComposer->getLocker() : null); $this->allowGlobalPluginRules = $this->parseAllowedPlugins($globalComposer !== null ? $globalComposer->getConfig()->get('allow-plugins') : false);
} }
/** /**

View File

@ -15,10 +15,12 @@ namespace Composer\Test\Plugin;
use Composer\Composer; use Composer\Composer;
use Composer\Config; use Composer\Config;
use Composer\Installer\PluginInstaller; use Composer\Installer\PluginInstaller;
use Composer\Json\JsonFile;
use Composer\Package\CompleteAliasPackage; use Composer\Package\CompleteAliasPackage;
use Composer\Package\CompletePackage; use Composer\Package\CompletePackage;
use Composer\Package\Loader\JsonLoader; use Composer\Package\Loader\JsonLoader;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Locker;
use Composer\Package\RootPackage; use Composer\Package\RootPackage;
use Composer\Plugin\PluginManager; use Composer\Plugin\PluginManager;
use Composer\IO\BufferIO; use Composer\IO\BufferIO;
@ -26,6 +28,7 @@ use Composer\EventDispatcher\EventDispatcher;
use Composer\Autoload\AutoloadGenerator; use Composer\Autoload\AutoloadGenerator;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\Platform;
class PluginInstallerTest extends TestCase class PluginInstallerTest extends TestCase
{ {
@ -123,6 +126,7 @@ class PluginInstallerTest extends TestCase
$this->composer->setAutoloadGenerator($this->autoloadGenerator); $this->composer->setAutoloadGenerator($this->autoloadGenerator);
$this->composer->setEventDispatcher(new EventDispatcher($this->composer, $this->io)); $this->composer->setEventDispatcher(new EventDispatcher($this->composer, $this->io));
$this->composer->setPackage(new RootPackage('dummy/root', '1.0.0.0', '1.0.0')); $this->composer->setPackage(new RootPackage('dummy/root', '1.0.0.0', '1.0.0'));
$this->composer->setLocker(new Locker($this->io, new JsonFile(Platform::getDevNull()), $im, '{}'));
$config->merge(array( $config->merge(array(
'config' => array( 'config' => array(