1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Undo addition of initializeInstalled and remove inline copy of the data from the class

This commit is contained in:
Jordi Boggiano 2021-05-21 14:11:25 +02:00
parent 3fe4f84a76
commit 82cffa17d3
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
2 changed files with 13 additions and 15 deletions

View file

@ -130,14 +130,9 @@ class FilesystemRepository extends WritableArrayRepository
if ($this->dumpVersions) {
$versions = $this->generateInstalledVersions($installationManager, $installPaths, $devMode, $repoDir);
$versionsCode = $this->dumpToPhpCode($versions);
$fs->filePutContentsIfModified($repoDir.'/installed.php', '<?php return ' . $versionsCode . ';'."\n");
$fs->filePutContentsIfModified($repoDir.'/installed.php', '<?php return ' . $this->dumpToPhpCode($versions) . ';'."\n");
$installedVersionsClass = file_get_contents(__DIR__.'/../InstalledVersions.php');
// while not strictly needed since https://github.com/composer/composer/pull/9635 - we keep this for BC
// and overall broader compatibility with people that may not use Composer's ClassLoader. They can
// simply include InstalledVersions.php manually and have it working in a basic way.
$installedVersionsClass = str_replace('public static function initializeInstalled() {}', 'public static function initializeInstalled() {' . PHP_EOL . 'self::$installed = ' . $versionsCode . ';' . PHP_EOL . '}', $installedVersionsClass);
$fs->filePutContentsIfModified($repoDir.'/InstalledVersions.php', $installedVersionsClass);
\Composer\InstalledVersions::reload($versions);