1
0
Fork 0

Use spl_object_hash() instead of the package id which doesn't exist anymore

pull/1/head
Jordi Boggiano 2011-05-22 09:05:24 +02:00
parent b85c1a2780
commit 831f5219b6
2 changed files with 23 additions and 18 deletions

View File

@ -39,12 +39,12 @@ class Literal
public function getPackageId()
{
return $this->package->getId();
return spl_object_hash($this->package);
}
public function getId()
{
return (($this->wanted) ? 1 : -1) * $this->package->getId();
return (($this->wanted) ? 1 : -1) * spl_object_hash($this->package);
}
public function __toString()

View File

@ -251,14 +251,14 @@ class Solver
while (!$workQueue->isEmpty()) {
$package = $workQueue->dequeue();
if (isset($this->addedMap[$package->getId()])) {
if (isset($this->addedMap[$this->getId($package)])) {
continue;
}
$this->addedMap[$package->getId()] = true;
$this->addedMap[$this->getId($package)] = true;
$dontFix = 0;
if ($this->installed === $package->getRepository() && !isset($this->fixMap[$package->getId()])) {
if ($this->installed === $package->getRepository() && !isset($this->fixMap[$this->getId($package)])) {
$dontFix = 1;
}
@ -451,13 +451,13 @@ class Solver
switch ($job['cmd']) {
case 'update-all':
foreach ($installedPackages as $package) {
$this->updateMap[$package->getId()] = true;
$this->updateMap[$this->getId($package)] = true;
}
break;
case 'fix-all':
foreach ($installedPackages as $package) {
$this->fixMap[$package->getId()] = true;
$this->fixMap[$this->getId($package)] = true;
}
break;
}
@ -466,12 +466,12 @@ class Solver
switch ($job['cmd']) {
case 'fix':
if ($this->installed === $package->getRepository()) {
$this->fixMap[$package->getId()] = true;
$this->fixMap[$this->getId($package)] = true;
}
break;
case 'update':
if ($this->installed === $package->getRepository()) {
$this->updateMap[$package->getId()] = true;
$this->updateMap[$this->getId($package)] = true;
}
break;
}
@ -491,7 +491,7 @@ class Solver
foreach ($job['packages'] as $package) {
switch ($job['cmd']) {
case 'install':
$this->installCandidateMap[$package->getId()] = true;
$this->installCandidateMap[$this->getId($package)] = true;
$this->addRulesForPackage($package);
break;
}
@ -646,22 +646,22 @@ class Solver
));
}
protected function decided(Package $p)
protected function decided(PackageInterface $package)
{
return isset($this->decisionMap[$p->getId()]);
return isset($this->decisionMap[$this->getId($package)]);
}
protected function undecided(Package $p)
protected function undecided(PackageInterface $package)
{
return !isset($this->decisionMap[$p->getId()]);
return !isset($this->decisionMap[$this->getId($package)]);
}
protected function decidedInstall(Package $p) {
return isset($this->decisionMap[$p->getId()]) && $this->decisionMap[$p->getId()] > 0;
protected function decidedInstall(PackageInterface $package) {
return isset($this->decisionMap[$this->getId($package)]) && $this->decisionMap[$this->getId($package)] > 0;
}
protected function decidedRemove(Package $p) {
return isset($this->decisionMap[$p->getId()]) && $this->decisionMap[$p->getId()] < 0;
protected function decidedRemove(PackageInterface $package) {
return isset($this->decisionMap[$this->getId($package)]) && $this->decisionMap[$this->getId($package)] < 0;
}
/**
@ -735,6 +735,11 @@ class Solver
return null;
}
private function getId($package)
{
return spl_object_hash($package);
}
private function setPropagateLearn($level, Literal $literal, $disableRules, Rule $rule)
{
return 0;