|
60 | 60 | */
|
61 | 61 | class Flex implements PluginInterface, EventSubscriberInterface
|
62 | 62 | {
|
| 63 | + public static $storedOperations = null; |
63 | 64 | /**
|
64 | 65 | * @var Composer
|
65 | 66 | */
|
@@ -126,6 +127,15 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
|
126 | 127 | $this->config = $composer->getConfig();
|
127 | 128 | $this->options = $this->initOptions();
|
128 | 129 |
|
| 130 | + // if Flex is being upgraded, the original operations from the original Flex |
| 131 | + // instance are stored in the static property, so we can reuse them now. |
| 132 | + if (property_exists(Flex::class, 'storedOperations')) { |
| 133 | + if (null !== Flex::$storedOperations) { |
| 134 | + $this->operations = Flex::$storedOperations; |
| 135 | + Flex::$storedOperations = null; |
| 136 | + } |
| 137 | + } |
| 138 | + |
129 | 139 | $symfonyRequire = preg_replace('/\.x$/', '.x-dev', getenv('SYMFONY_REQUIRE') ?: ($composer->getPackage()->getExtra()['symfony']['require'] ?? ''));
|
130 | 140 |
|
131 | 141 | if ($composer2 = version_compare('2.0.0', PluginInterface::PLUGIN_API_VERSION, '<=')) {
|
@@ -293,6 +303,8 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
|
293 | 303 |
|
294 | 304 | public function deactivate(Composer $composer, IOInterface $io)
|
295 | 305 | {
|
| 306 | + // store operations in case Flex is being upgraded |
| 307 | + self::$storedOperations = $this->operations; |
296 | 308 | self::$activated = false;
|
297 | 309 | }
|
298 | 310 |
|
|
0 commit comments