Make project id public
Reduction of rougly 1.3 million function calls on packagist updatepull/3481/head
parent
ef41f136f8
commit
c6af09b1da
|
@ -151,18 +151,18 @@ class DefaultPolicy implements PolicyInterface
|
|||
}
|
||||
|
||||
// priority equal, sort by package id to make reproducible
|
||||
if ($a->getId() === $b->getId()) {
|
||||
if ($a->id === $b->id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a->getId() < $b->getId()) ? -1 : 1;
|
||||
return ($a->id < $b->id) ? -1 : 1;
|
||||
}
|
||||
|
||||
if (isset($installedMap[$a->getId()])) {
|
||||
if (isset($installedMap[$a->id])) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (isset($installedMap[$b->getId()])) {
|
||||
if (isset($installedMap[$b->id])) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -227,7 +227,7 @@ class DefaultPolicy implements PolicyInterface
|
|||
foreach ($literals as $literal) {
|
||||
$package = $pool->literalToPackage($literal);
|
||||
|
||||
if (isset($installedMap[$package->getId()])) {
|
||||
if (isset($installedMap[$package->id])) {
|
||||
$selected[] = $literal;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class Pool
|
|||
if ($exempt || $this->isPackageAcceptable($names, $stability)) {
|
||||
$package->setId($this->id++);
|
||||
$this->packages[] = $package;
|
||||
$this->packageByExactName[$package->getName()][$package->getId()] = $package;
|
||||
$this->packageByExactName[$package->getName()][$package->id] = $package;
|
||||
|
||||
foreach ($names as $provided) {
|
||||
$this->packageByName[$provided][] = $package;
|
||||
|
@ -122,7 +122,7 @@ class Pool
|
|||
|
||||
$package->getRepository()->addPackage($aliasPackage);
|
||||
$this->packages[] = $aliasPackage;
|
||||
$this->packageByExactName[$aliasPackage->getName()][$aliasPackage->getId()] = $aliasPackage;
|
||||
$this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
|
||||
|
||||
foreach ($aliasPackage->getNames() as $name) {
|
||||
$this->packageByName[$name][] = $aliasPackage;
|
||||
|
@ -186,7 +186,7 @@ class Pool
|
|||
foreach ($this->providerRepos as $repo) {
|
||||
foreach ($repo->whatProvides($this, $name) as $candidate) {
|
||||
$candidates[] = $candidate;
|
||||
if ($candidate->getId() < 1) {
|
||||
if ($candidate->id < 1) {
|
||||
$candidate->setId($this->id++);
|
||||
$this->packages[$this->id - 2] = $candidate;
|
||||
}
|
||||
|
@ -217,8 +217,8 @@ class Pool
|
|||
}
|
||||
|
||||
if ($this->whitelist !== null && (
|
||||
(!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->getId()])) ||
|
||||
($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->getId()]))
|
||||
(!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
|
||||
($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ class Pool
|
|||
{
|
||||
$package = $this->literalToPackage($literal);
|
||||
|
||||
if (isset($installedMap[$package->getId()])) {
|
||||
if (isset($installedMap[$package->id])) {
|
||||
$prefix = ($literal > 0 ? 'keep' : 'remove');
|
||||
} else {
|
||||
$prefix = ($literal > 0 ? 'install' : 'don\'t install');
|
||||
|
|
|
@ -51,14 +51,14 @@ class RuleSetGenerator
|
|||
*/
|
||||
protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
|
||||
{
|
||||
$literals = array(-$package->getId());
|
||||
$literals = array(-$package->id);
|
||||
|
||||
foreach ($providers as $provider) {
|
||||
// self fulfilling rule?
|
||||
if ($provider === $package) {
|
||||
return null;
|
||||
}
|
||||
$literals[] = $provider->getId();
|
||||
$literals[] = $provider->id;
|
||||
}
|
||||
|
||||
return new Rule($this->pool, $literals, $reason, $reasonData);
|
||||
|
@ -80,7 +80,7 @@ class RuleSetGenerator
|
|||
{
|
||||
$literals = array();
|
||||
foreach ($packages as $package) {
|
||||
$literals[] = $package->getId();
|
||||
$literals[] = $package->id;
|
||||
}
|
||||
|
||||
return new Rule($this->pool, $literals, $reason, $job['packageName'], $job);
|
||||
|
@ -99,7 +99,7 @@ class RuleSetGenerator
|
|||
*/
|
||||
protected function createRemoveRule(PackageInterface $package, $reason, $job)
|
||||
{
|
||||
return new Rule($this->pool, array(-$package->getId()), $reason, $job['packageName'], $job);
|
||||
return new Rule($this->pool, array(-$package->id), $reason, $job['packageName'], $job);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -123,7 +123,7 @@ class RuleSetGenerator
|
|||
return null;
|
||||
}
|
||||
|
||||
return new Rule($this->pool, array(-$issuer->getId(), -$provider->getId()), $reason, $reasonData);
|
||||
return new Rule($this->pool, array(-$issuer->id, -$provider->id), $reason, $reasonData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,11 +151,11 @@ class RuleSetGenerator
|
|||
|
||||
while (!$workQueue->isEmpty()) {
|
||||
$package = $workQueue->dequeue();
|
||||
if (isset($this->whitelistedMap[$package->getId()])) {
|
||||
if (isset($this->whitelistedMap[$package->id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->whitelistedMap[$package->getId()] = true;
|
||||
$this->whitelistedMap[$package->id] = true;
|
||||
|
||||
foreach ($package->getRequires() as $link) {
|
||||
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
|
||||
|
@ -186,11 +186,11 @@ class RuleSetGenerator
|
|||
|
||||
while (!$workQueue->isEmpty()) {
|
||||
$package = $workQueue->dequeue();
|
||||
if (isset($this->addedMap[$package->getId()])) {
|
||||
if (isset($this->addedMap[$package->id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->addedMap[$package->getId()] = true;
|
||||
$this->addedMap[$package->id] = true;
|
||||
|
||||
foreach ($package->getRequires() as $link) {
|
||||
if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
|
||||
|
@ -215,7 +215,7 @@ class RuleSetGenerator
|
|||
}
|
||||
|
||||
// check obsoletes and implicit obsoletes of a package
|
||||
$isInstalled = (isset($this->installedMap[$package->getId()]));
|
||||
$isInstalled = (isset($this->installedMap[$package->id]));
|
||||
|
||||
foreach ($package->getReplaces() as $link) {
|
||||
$obsoleteProviders = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
|
||||
|
@ -289,7 +289,7 @@ class RuleSetGenerator
|
|||
$packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
|
||||
if ($packages) {
|
||||
foreach ($packages as $package) {
|
||||
if (!isset($this->installedMap[$package->getId()])) {
|
||||
if (!isset($this->installedMap[$package->id])) {
|
||||
$this->addRulesForPackage($package, $ignorePlatformReqs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ class Solver
|
|||
{
|
||||
$this->installedMap = array();
|
||||
foreach ($this->installed->getPackages() as $package) {
|
||||
$this->installedMap[$package->getId()] = $package;
|
||||
$this->installedMap[$package->id] = $package;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,15 +136,15 @@ class Solver
|
|||
case 'update':
|
||||
$packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
|
||||
foreach ($packages as $package) {
|
||||
if (isset($this->installedMap[$package->getId()])) {
|
||||
$this->updateMap[$package->getId()] = true;
|
||||
if (isset($this->installedMap[$package->id])) {
|
||||
$this->updateMap[$package->id] = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'update-all':
|
||||
foreach ($this->installedMap as $package) {
|
||||
$this->updateMap[$package->getId()] = true;
|
||||
$this->updateMap[$package->id] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ class Transaction
|
|||
$package = $this->pool->literalToPackage($literal);
|
||||
|
||||
// wanted & installed || !wanted & !installed
|
||||
if (($literal > 0) == (isset($this->installedMap[$package->getId()]))) {
|
||||
if (($literal > 0) == (isset($this->installedMap[$package->id]))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Transaction
|
|||
if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
|
||||
$source = $installMeansUpdateMap[abs($literal)];
|
||||
|
||||
$updateMap[$package->getId()] = array(
|
||||
$updateMap[$package->id] = array(
|
||||
'package' => $package,
|
||||
'source' => $source,
|
||||
'reason' => $reason,
|
||||
|
@ -65,9 +65,9 @@ class Transaction
|
|||
|
||||
// avoid updates to one package from multiple origins
|
||||
unset($installMeansUpdateMap[abs($literal)]);
|
||||
$ignoreRemove[$source->getId()] = true;
|
||||
$ignoreRemove[$source->id] = true;
|
||||
} else {
|
||||
$installMap[$package->getId()] = array(
|
||||
$installMap[$package->id] = array(
|
||||
'package' => $package,
|
||||
'reason' => $reason,
|
||||
);
|
||||
|
@ -81,9 +81,9 @@ class Transaction
|
|||
$package = $this->pool->literalToPackage($literal);
|
||||
|
||||
if ($literal <= 0 &&
|
||||
isset($this->installedMap[$package->getId()]) &&
|
||||
!isset($ignoreRemove[$package->getId()])) {
|
||||
$uninstallMap[$package->getId()] = array(
|
||||
isset($this->installedMap[$package->id]) &&
|
||||
!isset($ignoreRemove[$package->id])) {
|
||||
$uninstallMap[$package->id] = array(
|
||||
'package' => $package,
|
||||
'reason' => $reason,
|
||||
);
|
||||
|
@ -107,7 +107,7 @@ class Transaction
|
|||
|
||||
while (!empty($queue)) {
|
||||
$package = array_pop($queue);
|
||||
$packageId = $package->getId();
|
||||
$packageId = $package->id;
|
||||
|
||||
if (!isset($visited[$packageId])) {
|
||||
array_push($queue, $package);
|
||||
|
@ -124,7 +124,7 @@ class Transaction
|
|||
}
|
||||
}
|
||||
|
||||
$visited[$package->getId()] = true;
|
||||
$visited[$package->id] = true;
|
||||
} else {
|
||||
if (isset($installMap[$packageId])) {
|
||||
$this->install(
|
||||
|
@ -165,7 +165,7 @@ class Transaction
|
|||
$possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
|
||||
|
||||
foreach ($possibleRequires as $require) {
|
||||
unset($roots[$require->getId()]);
|
||||
unset($roots[$require->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,13 +186,13 @@ class Transaction
|
|||
}
|
||||
|
||||
// !wanted & installed
|
||||
if ($literal <= 0 && isset($this->installedMap[$package->getId()])) {
|
||||
if ($literal <= 0 && isset($this->installedMap[$package->id])) {
|
||||
$updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
|
||||
|
||||
$literals = array($package->getId());
|
||||
$literals = array($package->id);
|
||||
|
||||
foreach ($updates as $update) {
|
||||
$literals[] = $update->getId();
|
||||
$literals[] = $update->id;
|
||||
}
|
||||
|
||||
foreach ($literals as $updateLiteral) {
|
||||
|
|
|
@ -48,9 +48,10 @@ abstract class BasePackage implements PackageInterface
|
|||
protected $prettyName;
|
||||
|
||||
protected $repository;
|
||||
protected $id;
|
||||
protected $transportOptions;
|
||||
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* All descendants' constructors should call this parent constructor
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue