1
0
Fork 0

Remove the allowUninstall policy option and clean up the only usage

pull/318/head
Volker Dusch 2012-02-18 18:31:19 +01:00
parent cbc021c05d
commit ec61297122
3 changed files with 3 additions and 14 deletions

View File

@ -21,11 +21,6 @@ use Composer\Package\LinkConstraint\VersionConstraint;
*/ */
class DefaultPolicy implements PolicyInterface class DefaultPolicy implements PolicyInterface
{ {
public function allowUninstall()
{
return true;
}
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator) public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
{ {
$constraint = new VersionConstraint($operator, $b->getVersion()); $constraint = new VersionConstraint($operator, $b->getVersion());

View File

@ -20,7 +20,6 @@ use Composer\Package\PackageInterface;
*/ */
interface PolicyInterface interface PolicyInterface
{ {
function allowUninstall();
function versionCompare(PackageInterface $a, PackageInterface $b, $operator); function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
function findUpdatePackages(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package); function findUpdatePackages(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package);
function installable(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package); function installable(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package);

View File

@ -986,14 +986,9 @@ class Solver
$updates = $this->policy->findUpdatePackages($this, $this->pool, $this->installedMap, $package); $updates = $this->policy->findUpdatePackages($this, $this->pool, $this->installedMap, $package);
$rule = $this->createUpdateRule($package, $updates, self::RULE_INTERNAL_ALLOW_UPDATE, (string) $package); $rule = $this->createUpdateRule($package, $updates, self::RULE_INTERNAL_ALLOW_UPDATE, (string) $package);
if ($this->policy->allowUninstall()) { $rule->setWeak(true);
$rule->setWeak(true); $this->addRule(RuleSet::TYPE_FEATURE, $rule);
$this->addRule(RuleSet::TYPE_FEATURE, $rule); $this->packageToFeatureRule[$package->getId()] = $rule;
$this->packageToFeatureRule[$package->getId()] = $rule;
} else {
$this->addRule(RuleSet::TYPE_UPDATE, $rule);
$this->packageToUpdateRule[$package->getId()] = $rule;
}
} }
foreach ($this->jobs as $job) { foreach ($this->jobs as $job) {