mirror of
https://github.com/composer/composer
synced 2025-05-11 01:22:54 +00:00
Always load the current InstalledVersions when writing to disk, fixes #9457
This commit is contained in:
parent
14d20776a2
commit
fec44f883c
2 changed files with 13 additions and 0 deletions
|
@ -206,6 +206,14 @@ class FilesystemRepository extends WritableArrayRepository
|
|||
$installedVersionsClass = file_get_contents(__DIR__.'/../InstalledVersions.php');
|
||||
$installedVersionsClass = str_replace('private static $installed;', 'private static $installed = '.var_export($versions, true).';', $installedVersionsClass);
|
||||
$fs->filePutContentsIfModified($repoDir.'/InstalledVersions.php', $installedVersionsClass);
|
||||
|
||||
// make sure the InstalledVersions class is loaded and has the latest state
|
||||
// not using the autoloader here to avoid loading the one from Composer's vendor dir
|
||||
if (!class_exists('Composer\InstalledVersions', false)) {
|
||||
include $repoDir.'/InstalledVersions.php';
|
||||
} else {
|
||||
\Composer\InstalledVersions::reload($versions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue