Переглянути джерело

Load plugins and installers prior to checking installed packages

Nils Adermann 11 роки тому
батько
коміт
bf08019292

+ 4 - 4
src/Composer/Factory.php

@@ -260,6 +260,10 @@ class Factory
         // add installers to the manager
         $this->createDefaultInstallers($im, $composer, $io);
 
+        if (!$disablePlugins) {
+            $pm->loadInstalledPlugins();
+        }
+
         // purge packages if they have been deleted on the filesystem
         $this->purgePackages($rm, $im);
 
@@ -272,10 +276,6 @@ class Factory
             $composer->setLocker($locker);
         }
 
-        if (!$disablePlugins) {
-            $pm->loadInstalledPlugins();
-        }
-
         return $composer;
     }
 

+ 1 - 1
src/Composer/Plugin/PluginManager.php

@@ -172,7 +172,7 @@ class PluginManager
         $generator = $this->composer->getAutoloadGenerator();
         $autoloads = array();
         foreach ($autoloadPackages as $autoloadPackage) {
-            $downloadPath = $this->getInstallPath($autoloadPackage, !$localRepo->hasPackage($autoloadPackage));
+            $downloadPath = $this->getInstallPath($autoloadPackage, ($this->globalRepository && $this->globalRepository->hasPackage($autoloadPackage)));
             $autoloads[] = array($autoloadPackage, $downloadPath);
         }
 

+ 1 - 0
tests/Composer/Test/Plugin/PluginInstallerTest.php

@@ -69,6 +69,7 @@ class PluginInstallerTest extends \PHPUnit_Framework_TestCase
         $config->merge(array(
             'config' => array(
                 'vendor-dir' => __DIR__.'/Fixtures/',
+                'home' => __DIR__.'/Fixtures',
                 'bin-dir' => __DIR__.'/Fixtures/bin',
             ),
         ));