Skip to content

Commit 84de0f9

Browse files
committed
Merge branch '1.x' into 2.x
* 1.x: [Bug] Fix Flex not installing recipes while it is being upgraded
2 parents 9c402af + 333abcf commit 84de0f9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Flex.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
*/
5353
class Flex implements PluginInterface, EventSubscriberInterface
5454
{
55+
public static $storedOperations = [];
56+
5557
/**
5658
* @var Composer
5759
*/
@@ -111,6 +113,13 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
111113
$this->config = $composer->getConfig();
112114
$this->options = $this->initOptions();
113115

116+
// if Flex is being upgraded, the original operations from the original Flex
117+
// instance are stored in the static property, so we can reuse them now.
118+
if (property_exists(self::class, 'storedOperations') && self::$storedOperations) {
119+
$this->operations = self::$storedOperations;
120+
self::$storedOperations = [];
121+
}
122+
114123
$symfonyRequire = preg_replace('/\.x$/', '.x-dev', getenv('SYMFONY_REQUIRE') ?: ($composer->getPackage()->getExtra()['symfony']['require'] ?? ''));
115124

116125
$rfs = Factory::createHttpDownloader($this->io, $this->config);
@@ -201,6 +210,8 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
201210
*/
202211
public function deactivate(Composer $composer, IOInterface $io)
203212
{
213+
// store operations in case Flex is being upgraded
214+
self::$storedOperations = $this->operations;
204215
self::$activated = false;
205216
}
206217

0 commit comments

Comments
 (0)