Fix root aliasing with new providers repo format
parent
cac0e71d45
commit
125ff3e4f5
|
@ -83,6 +83,7 @@ class Pool
|
|||
|
||||
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
|
||||
$this->composerRepos[] = $repo;
|
||||
$repo->setRootAliases($rootAliases);
|
||||
$repo->resetPackageIds();
|
||||
} elseif ($repo instanceof StreamableRepositoryInterface) {
|
||||
foreach ($repo->getMinimalPackages() as $package) {
|
||||
|
|
|
@ -40,6 +40,7 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
|
|||
protected $providers = array();
|
||||
protected $providersByUid = array();
|
||||
protected $loader;
|
||||
protected $rootAliases;
|
||||
private $rawData;
|
||||
private $minimalPackages;
|
||||
private $degradedMode = false;
|
||||
|
@ -103,6 +104,11 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
|
|||
@file_get_contents($url, false, $context);
|
||||
}
|
||||
|
||||
public function setRootAliases(array $rootAliases)
|
||||
{
|
||||
$this->rootAliases = $rootAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -250,6 +256,10 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
|
|||
} else {
|
||||
$this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
|
||||
}
|
||||
// check for root aliases
|
||||
if (isset($this->providersByUid[$version['uid'].'-root'])) {
|
||||
$this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!$pool->isPackageAcceptable($version['name'], VersionParser::parseStability($version['version']))) {
|
||||
|
@ -271,6 +281,23 @@ class ComposerRepository extends ArrayRepository implements NotifiableRepository
|
|||
// override provider with its alias so it can be expanded in the if block above
|
||||
$this->providersByUid[$version['uid']] = $alias;
|
||||
}
|
||||
|
||||
// handle root package aliases
|
||||
unset($rootAliasData);
|
||||
|
||||
if (isset($this->rootAliases[$name][$package->getVersion()])) {
|
||||
$rootAliasData = $this->rootAliases[$name][$package->getVersion()];
|
||||
} elseif (($aliasNormalized = $package->getAlias()) && isset($this->rootAliases[$name][$aliasNormalized])) {
|
||||
$rootAliasData = $this->rootAliases[$name][$aliasNormalized];
|
||||
}
|
||||
|
||||
if (isset($rootAliasData)) {
|
||||
$alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
|
||||
$alias->setRepository($this);
|
||||
|
||||
$this->providers[$name][$version['uid'].'-root'] = $alias;
|
||||
$this->providersByUid[$version['uid'].'-root'] = $alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue