浏览代码

Merge pull request #7633 from naderman/remove-pool-whitelist

Remove pool whitelist
Nils Adermann 6 年之前
父节点
当前提交
53c5e3c076
共有 2 个文件被更改,包括 0 次插入79 次删除
  1. 0 21
      src/Composer/DependencyResolver/Pool.php
  2. 0 58
      src/Composer/DependencyResolver/RuleSetGenerator.php

+ 0 - 21
src/Composer/DependencyResolver/Pool.php

@@ -49,7 +49,6 @@ class Pool implements \Countable
     protected $versionParser;
     protected $providerCache = array();
     protected $filterRequires;
-    protected $whitelist = null;
 
     public function __construct(array $filterRequires = array())
     {
@@ -57,12 +56,6 @@ class Pool implements \Countable
         $this->versionParser = new VersionParser;
     }
 
-    public function setWhitelist($whitelist)
-    {
-        $this->whitelist = $whitelist;
-        $this->providerCache = array();
-    }
-
     public function setPackages(array $packages, array $priorities = array())
     {
         $this->priorities = $priorities;
@@ -149,20 +142,6 @@ class Pool implements \Countable
         $nameMatch = false;
 
         foreach ($candidates as $candidate) {
-            $aliasOfCandidate = null;
-
-            // alias packages are not white listed, make sure that the package
-            // being aliased is white listed
-            if ($candidate instanceof AliasPackage) {
-                $aliasOfCandidate = $candidate->getAliasOf();
-            }
-
-            if ($this->whitelist !== null && !$bypassFilters && (
-                (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
-                ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
-            )) {
-                continue;
-            }
             switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
                 case self::MATCH_NONE:
                     break;

+ 0 - 58
src/Composer/DependencyResolver/RuleSetGenerator.php

@@ -26,7 +26,6 @@ class RuleSetGenerator
     protected $rules;
     protected $jobs;
     protected $installedMap;
-    protected $whitelistedMap;
     protected $addedMap;
     protected $conflictAddedMap;
     protected $addedPackages;
@@ -147,41 +146,6 @@ class RuleSetGenerator
         $this->rules->add($newRule, $type);
     }
 
-    protected function whitelistFromPackage(PackageInterface $package)
-    {
-        $workQueue = new \SplQueue;
-        $workQueue->enqueue($package);
-
-        while (!$workQueue->isEmpty()) {
-            $package = $workQueue->dequeue();
-            if (isset($this->whitelistedMap[$package->id])) {
-                continue;
-            }
-
-            $this->whitelistedMap[$package->id] = true;
-
-            foreach ($package->getRequires() as $link) {
-                $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
-
-                foreach ($possibleRequires as $require) {
-                    $workQueue->enqueue($require);
-                }
-            }
-
-            $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
-
-            foreach ($obsoleteProviders as $provider) {
-                if ($provider === $package) {
-                    continue;
-                }
-
-                if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
-                    $workQueue->enqueue($provider);
-                }
-            }
-        }
-    }
-
     protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
     {
         $workQueue = new \SplQueue;
@@ -290,20 +254,6 @@ class RuleSetGenerator
         return $impossible;
     }
 
-    protected function whitelistFromJobs()
-    {
-        foreach ($this->jobs as $job) {
-            switch ($job['cmd']) {
-                case 'install':
-                    $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
-                    foreach ($packages as $package) {
-                        $this->whitelistFromPackage($package);
-                    }
-                    break;
-            }
-        }
-    }
-
     protected function addRulesForJobs($ignorePlatformReqs)
     {
         foreach ($this->jobs as $job) {
@@ -344,14 +294,6 @@ class RuleSetGenerator
         $this->rules = new RuleSet;
         $this->installedMap = $installedMap;
 
-        $this->whitelistedMap = array();
-        foreach ($this->installedMap as $package) {
-            $this->whitelistFromPackage($package);
-        }
-        $this->whitelistFromJobs();
-
-        $this->pool->setWhitelist($this->whitelistedMap);
-
         $this->addedMap = array();
         $this->conflictAddedMap = array();
         $this->addedPackages = array();