mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-11 22:08:54 +00:00
[ticket/16650] Adjust code for retrieving packagist info for composer 2
PHPBB3-16650
This commit is contained in:
parent
422cf5493f
commit
3ec259c365
1 changed files with 9 additions and 9 deletions
|
@ -22,7 +22,7 @@ use Composer\Package\BasePackage;
|
||||||
use Composer\Package\CompletePackage;
|
use Composer\Package\CompletePackage;
|
||||||
use Composer\Repository\ComposerRepository;
|
use Composer\Repository\ComposerRepository;
|
||||||
use Composer\Semver\Constraint\ConstraintInterface;
|
use Composer\Semver\Constraint\ConstraintInterface;
|
||||||
use Composer\Util\RemoteFilesystem;
|
use Composer\Util\HttpDownloader;
|
||||||
use phpbb\composer\io\null_io;
|
use phpbb\composer\io\null_io;
|
||||||
use phpbb\config\config;
|
use phpbb\config\config;
|
||||||
use phpbb\exception\runtime_exception;
|
use phpbb\exception\runtime_exception;
|
||||||
|
@ -301,21 +301,21 @@ class installer
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ($repository instanceof ComposerRepository && $repository->hasProviders())
|
if ($repository instanceof ComposerRepository)
|
||||||
{
|
{
|
||||||
// Special case for packagist which exposes an api to retrieve all packages of a given type.
|
// Special case for packagist which exposes an api to retrieve all packages of a given type.
|
||||||
// For the others composer repositories with providers we can't do anything. It would be too slow.
|
// For the others composer repositories with providers we can't do anything. It would be too slow.
|
||||||
|
|
||||||
$r = new \ReflectionObject($repository);
|
$repositoryReflection = new \ReflectionObject($repository);
|
||||||
$repo_url = $r->getProperty('url');
|
$repo_url = $repositoryReflection->getProperty('url');
|
||||||
$repo_url->setAccessible(true);
|
$repo_url->setAccessible(true);
|
||||||
|
|
||||||
if ($repo_url->getValue($repository) === 'http://packagist.org')
|
if ($repo_url->getValue($repository) === 'https://repo.packagist.org')
|
||||||
{
|
{
|
||||||
$url = 'https://packagist.org/packages/list.json?type=' . $type;
|
$url = 'https://packagist.org/packages/list.json?type=' . $type;
|
||||||
$rfs = new RemoteFilesystem($io);
|
$composer_config = new \Composer\Config([]);
|
||||||
$hostname = parse_url($url, PHP_URL_HOST) ?: $url;
|
$downloader = new HttpDownloader($io, $composer_config);
|
||||||
$json = $rfs->getContents($hostname, $url, false);
|
$json = $downloader->get($url)->getBody();
|
||||||
|
|
||||||
/** @var \Composer\Package\PackageInterface $package */
|
/** @var \Composer\Package\PackageInterface $package */
|
||||||
foreach (JsonFile::parseJson($json, $url)['packageNames'] as $package)
|
foreach (JsonFile::parseJson($json, $url)['packageNames'] as $package)
|
||||||
|
|
Loading…
Add table
Reference in a new issue