Skip to content

Commit

Permalink
Revert "Patch Composer 2 InstalledVersions out as it introduces issues"
Browse files Browse the repository at this point in the history
This reverts commit d26dd0a
  • Loading branch information
shyim committed Jun 7, 2021
1 parent 00875ba commit 2006e08
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/Components/PluginPrepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,6 @@ public function prepare(string $directory, bool $scopeDependencies, OutputInterf
$this->scopeDependencies($io, $plugin, $directory);
}
$this->exec('composer dump -o -d ' . escapeshellarg($directory));

// The InstalledVersions from composer 2 introduces issues when they exists multiple times. This patches it out
$installedVersions = $directory . '/vendor/composer/InstalledVersions.php';

$stripInstalledVersionRegex = '/\s*\'Composer\\\\\\\\InstalledVersions.*,$/m';

$autoloadClassMap = $directory . '/vendor/composer/autoload_classmap.php';
$autoloadStatic = $directory . '/vendor/composer/autoload_static.php';
$installedJson = $directory . '/vendor/composer/installed.json';
$installedPhp = $directory . '/vendor/composer/installed.php';

if (is_file($installedVersions)) {
unlink($installedVersions);

if (is_file($autoloadClassMap)) {
\file_put_contents($autoloadClassMap, preg_replace($stripInstalledVersionRegex, '', file_get_contents($autoloadClassMap)));
}

if (is_file($autoloadStatic)) {
\file_put_contents($autoloadStatic, preg_replace($stripInstalledVersionRegex, '', file_get_contents($autoloadStatic)));
}

if (is_file($installedPhp)) {
unlink($installedPhp);
}

if (is_file($installedJson)) {
unlink($installedJson);
}
}
}

rename($composerJsonBackup, $composerJson);
Expand Down

0 comments on commit 2006e08

Please sign in to comment.