Skip to content

Commit

Permalink
Merge pull request #4424 from nextcloud/backport/4419/stable31
Browse files Browse the repository at this point in the history
[stable31] chore: update composer files for composer v2.3.5
  • Loading branch information
elzody authored Jan 29, 2025
2 parents c1b0185 + beb0edd commit fdcfe86
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
20 changes: 18 additions & 2 deletions composer/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class InstalledVersions
*/
private static $installed;

/**
* @var bool
*/
private static $installedIsLocalDir;

/**
* @var bool|null
*/
Expand Down Expand Up @@ -309,6 +314,12 @@ public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();

// when using reload, we disable the duplicate protection to ensure that self::$installed data is
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
// so we have to assume it does not, and that may result in duplicate data being returned when listing
// all installed packages for example
self::$installedIsLocalDir = false;
}

/**
Expand All @@ -325,19 +336,24 @@ private static function getInstalled()
$copiedLocalDir = false;

if (self::$canGetVendors) {
$selfDir = strtr(__DIR__, '\\', '/');
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
$vendorDir = strtr($vendorDir, '\\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
self::$installedByVendor[$vendorDir] = $required;
$installed[] = $required;
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
self::$installed = $required;
$copiedLocalDir = true;
self::$installedIsLocalDir = true;
}
}
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
$copiedLocalDir = true;
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions composer/composer/installed.json.license

This file was deleted.

4 changes: 2 additions & 2 deletions composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'cfd48c8ab8986bf0b444fede00b5c3f70c0f703a',
'reference' => '8c21f5edd732074493f83a7e9c84b825ab8aab25',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => 'cfd48c8ab8986bf0b444fede00b5c3f70c0f703a',
'reference' => '8c21f5edd732074493f83a7e9c84b825ab8aab25',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down

0 comments on commit fdcfe86

Please sign in to comment.