Small fixes
parent
09fd239f24
commit
346de47af2
|
@ -374,7 +374,7 @@ EOT
|
||||||
{
|
{
|
||||||
$factory = new Factory();
|
$factory = new Factory();
|
||||||
|
|
||||||
return $factory->createDownloadManager($io, $config);
|
return $factory->createDownloadManager($io, $config, $factory->createHttpDownloader($io, $config));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function createInstallationManager()
|
protected function createInstallationManager()
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Composer\EventDispatcher\EventDispatcher;
|
||||||
use Composer\Downloader\TransportException;
|
use Composer\Downloader\TransportException;
|
||||||
use Composer\Semver\Constraint\ConstraintInterface;
|
use Composer\Semver\Constraint\ConstraintInterface;
|
||||||
use Composer\Semver\Constraint\Constraint;
|
use Composer\Semver\Constraint\Constraint;
|
||||||
|
use Composer\Semver\Constraint\EmptyConstraint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||||
|
@ -156,9 +157,19 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
*/
|
*/
|
||||||
public function findPackages($name, $constraint = null)
|
public function findPackages($name, $constraint = null)
|
||||||
{
|
{
|
||||||
if (!$this->hasProviders()) {
|
// this call initializes loadRootServerFile which is needed for the rest below to work
|
||||||
|
$hasProviders = $this->hasProviders();
|
||||||
|
|
||||||
|
// TODO we need a new way for the repo to report this v2 protocol somehow
|
||||||
|
if ($this->lazyProvidersUrl) {
|
||||||
|
return $this->loadAsyncPackages(array($name => new EmptyConstraint()), function ($name, $stability) {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!$hasProviders) {
|
||||||
return parent::findPackages($name, $constraint);
|
return parent::findPackages($name, $constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// normalize name
|
// normalize name
|
||||||
$name = strtolower($name);
|
$name = strtolower($name);
|
||||||
|
|
||||||
|
@ -197,10 +208,14 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
|
|
||||||
public function loadPackages(array $packageNameMap, $isPackageAcceptableCallable)
|
public function loadPackages(array $packageNameMap, $isPackageAcceptableCallable)
|
||||||
{
|
{
|
||||||
|
// this call initializes loadRootServerFile which is needed for the rest below to work
|
||||||
|
$hasProviders = $this->hasProviders();
|
||||||
|
|
||||||
|
// TODO we need a new way for the repo to report this v2 protocol somehow
|
||||||
if ($this->lazyProvidersUrl) {
|
if ($this->lazyProvidersUrl) {
|
||||||
return $this->loadAsyncPackages($packageNameMap, $isPackageAcceptableCallable);
|
return $this->loadAsyncPackages($packageNameMap, $isPackageAcceptableCallable);
|
||||||
}
|
}
|
||||||
if (!$this->hasProviders()) {
|
if (!$hasProviders) {
|
||||||
return parent::loadPackages($packageNameMap, $isPackageAcceptableCallable);
|
return parent::loadPackages($packageNameMap, $isPackageAcceptableCallable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,6 +240,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
}
|
}
|
||||||
$packages = array_merge($packages, $matches);
|
$packages = array_merge($packages, $matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $packages;
|
return $packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,6 +544,11 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
|
||||||
|
|
||||||
if ($this->lazyProvidersUrl) {
|
if ($this->lazyProvidersUrl) {
|
||||||
foreach ($packageNames as $name => $constraint) {
|
foreach ($packageNames as $name => $constraint) {
|
||||||
|
// skip platform packages, root package and composer-plugin-api
|
||||||
|
if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$url = str_replace('%package%', $name, $this->lazyProvidersUrl);
|
$url = str_replace('%package%', $name, $this->lazyProvidersUrl);
|
||||||
$cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
|
$cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Repository;
|
namespace Composer\Repository;
|
||||||
|
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
|
use Composer\Semver\Constraint\ConstraintInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repository interface.
|
* Repository interface.
|
||||||
|
@ -39,7 +40,7 @@ interface RepositoryInterface extends \Countable
|
||||||
* Searches for the first match of a package by name and version.
|
* Searches for the first match of a package by name and version.
|
||||||
*
|
*
|
||||||
* @param string $name package name
|
* @param string $name package name
|
||||||
* @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against
|
* @param string|ConstraintInterface $constraint package version or version constraint to match against
|
||||||
*
|
*
|
||||||
* @return PackageInterface|null
|
* @return PackageInterface|null
|
||||||
*/
|
*/
|
||||||
|
@ -49,7 +50,7 @@ interface RepositoryInterface extends \Countable
|
||||||
* Searches for all packages matching a name and optionally a version.
|
* Searches for all packages matching a name and optionally a version.
|
||||||
*
|
*
|
||||||
* @param string $name package name
|
* @param string $name package name
|
||||||
* @param string|\Composer\Semver\Constraint\ConstraintInterface $constraint package version or version constraint to match against
|
* @param string|ConstraintInterface $constraint package version or version constraint to match against
|
||||||
*
|
*
|
||||||
* @return PackageInterface[]
|
* @return PackageInterface[]
|
||||||
*/
|
*/
|
||||||
|
@ -66,7 +67,7 @@ interface RepositoryInterface extends \Countable
|
||||||
/**
|
/**
|
||||||
* Returns list of registered packages with the supplied name
|
* Returns list of registered packages with the supplied name
|
||||||
*
|
*
|
||||||
* @param bool[] $packageNameMap
|
* @param ConstraintInterface[] $packageNameMap package names pointing to constraints
|
||||||
* @param $isPackageAcceptableCallable
|
* @param $isPackageAcceptableCallable
|
||||||
* @return PackageInterface[]
|
* @return PackageInterface[]
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue