mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-06 06:25:04 +02:00
Merge pull request #6119 from marc1706/ticket/16650
[ticket/16650] Adjust code for retrieving packagist info for composer 2
This commit is contained in:
commit
fc3728055f
@ -14,6 +14,7 @@
|
||||
namespace phpbb\composer;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\DependencyResolver\Request as composer_request;
|
||||
use Composer\Factory;
|
||||
use Composer\IO\IOInterface;
|
||||
use Composer\IO\NullIO;
|
||||
@ -22,7 +23,7 @@ use Composer\Package\BasePackage;
|
||||
use Composer\Package\CompletePackage;
|
||||
use Composer\Repository\ComposerRepository;
|
||||
use Composer\Semver\Constraint\ConstraintInterface;
|
||||
use Composer\Util\RemoteFilesystem;
|
||||
use Composer\Util\HttpDownloader;
|
||||
use phpbb\composer\io\null_io;
|
||||
use phpbb\config\config;
|
||||
use phpbb\exception\runtime_exception;
|
||||
@ -159,7 +160,7 @@ class installer
|
||||
$composer = Factory::create($io, $this->get_composer_ext_json_filename(), false);
|
||||
$install = \Composer\Installer::create($io, $composer);
|
||||
|
||||
$composer->getDownloadManager()->setOutputProgress(false);
|
||||
$composer->getInstallationManager()->setOutputProgress(false);
|
||||
|
||||
$install
|
||||
->setVerbose(true)
|
||||
@ -167,8 +168,8 @@ class installer
|
||||
->setPreferDist(true)
|
||||
->setDevMode(false)
|
||||
->setUpdate(true)
|
||||
->setUpdateWhitelist($whitelist)
|
||||
->setWhitelistDependencies(false)
|
||||
->setUpdateAllowList($whitelist)
|
||||
->setUpdateAllowTransitiveDependencies(composer_request::UPDATE_ONLY_LISTED)
|
||||
->setIgnorePlatformRequirements(false)
|
||||
->setOptimizeAutoloader(true)
|
||||
->setDumpAutoloader(true)
|
||||
@ -301,21 +302,21 @@ class installer
|
||||
{
|
||||
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.
|
||||
// For the others composer repositories with providers we can't do anything. It would be too slow.
|
||||
|
||||
$r = new \ReflectionObject($repository);
|
||||
$repo_url = $r->getProperty('url');
|
||||
$repositoryReflection = new \ReflectionObject($repository);
|
||||
$repo_url = $repositoryReflection->getProperty('url');
|
||||
$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;
|
||||
$rfs = new RemoteFilesystem($io);
|
||||
$hostname = parse_url($url, PHP_URL_HOST) ?: $url;
|
||||
$json = $rfs->getContents($hostname, $url, false);
|
||||
$url = 'https://packagist.org/packages/list.json?type=' . $type;
|
||||
$composer_config = new \Composer\Config([]);
|
||||
$downloader = new HttpDownloader($io, $composer_config);
|
||||
$json = $downloader->get($url)->getBody();
|
||||
|
||||
/** @var \Composer\Package\PackageInterface $package */
|
||||
foreach (JsonFile::parseJson($json, $url)['packageNames'] as $package)
|
||||
|
Loading…
x
Reference in New Issue
Block a user