parent
08cf1a3fd7
commit
9438724f28
|
@ -149,15 +149,23 @@ class Indexer
|
||||||
$cacheKey = null;
|
$cacheKey = null;
|
||||||
$index = null;
|
$index = null;
|
||||||
foreach (array_merge($this->composerLock->packages, $this->composerLock->{'packages-dev'}) as $package) {
|
foreach (array_merge($this->composerLock->packages, $this->composerLock->{'packages-dev'}) as $package) {
|
||||||
// Check if package name matches and version is absolute
|
// Check if package can be cached.
|
||||||
// Dynamic constraints are not cached, because they can change every time
|
|
||||||
$packageVersion = ltrim($package->version, 'v');
|
$packageVersion = ltrim($package->version, 'v');
|
||||||
|
// If package is anchored to a version
|
||||||
if ($package->name === $packageName && strpos($packageVersion, 'dev') === false) {
|
if ($package->name === $packageName && strpos($packageVersion, 'dev') === false) {
|
||||||
$packageKey = $packageName . ':' . $packageVersion;
|
$packageKey = $packageName . ':' . $packageVersion;
|
||||||
$cacheKey = self::CACHE_VERSION . ':' . $packageKey;
|
$cacheKey = self::CACHE_VERSION . ':' . $packageKey;
|
||||||
// Check cache
|
// Check cache
|
||||||
$index = yield $this->cache->get($cacheKey);
|
$index = yield $this->cache->get($cacheKey);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// If package is checked out
|
||||||
|
} elseif ($package->name === $packageName && isset($package->source->reference)) {
|
||||||
|
$packageKey = $packageName . ':' . $package->source->reference;
|
||||||
|
$cacheKey = self::CACHE_VERSION . ':' . $packageKey;
|
||||||
|
// Check cache
|
||||||
|
$index = yield $this->cache->get($cacheKey);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($index !== null) {
|
if ($index !== null) {
|
||||||
|
|
Loading…
Reference in New Issue