@@ -77,14 +77,12 @@ class Flex implements PluginInterface, EventSubscriberInterface
77
77
private $ operations = [];
78
78
private $ lock ;
79
79
private $ displayThanksReminder = 0 ;
80
- private $ dryRun = false ;
81
80
private $ reinstall ;
82
81
private static $ activated = true ;
83
82
private static $ aliasResolveCommands = [
84
83
'require ' => true ,
85
84
'update ' => false ,
86
85
'remove ' => false ,
87
- 'unpack ' => true ,
88
86
];
89
87
private $ filter ;
90
88
@@ -108,6 +106,8 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
108
106
}
109
107
}
110
108
109
+ $ composer ->getInstallationManager ()->addInstaller (new SymfonyPackInstaller ($ io ));
110
+
111
111
$ this ->composer = $ composer ;
112
112
$ this ->io = $ io ;
113
113
$ this ->config = $ composer ->getConfig ();
@@ -122,7 +122,7 @@ class_exists(__NAMESPACE__.str_replace('/', '\\', substr($file, \strlen(__DIR__)
122
122
123
123
$ symfonyRequire = preg_replace ('/\.x$/ ' , '.x-dev ' , getenv ('SYMFONY_REQUIRE ' ) ?: ($ composer ->getPackage ()->getExtra ()['symfony ' ]['require ' ] ?? '' ));
124
124
125
- $ rfs = Factory:: createHttpDownloader ( $ this -> io , $ this -> config );
125
+ $ rfs = $ composer -> getLoop ()-> getHttpDownloader ( );
126
126
127
127
$ this ->downloader = $ downloader = new Downloader ($ composer , $ io , $ rfs );
128
128
@@ -221,14 +221,6 @@ public function configureInstaller()
221
221
foreach ($ backtrace as $ trace ) {
222
222
if (isset ($ trace ['object ' ]) && $ trace ['object ' ] instanceof Installer) {
223
223
$ this ->installer = $ trace ['object ' ]->setSuggestedPackagesReporter (new SuggestedPackagesReporter (new NullIO ()));
224
-
225
- $ updateAllowList = \Closure::bind (function () {
226
- return $ this ->updateAllowList ;
227
- }, $ this ->installer , $ this ->installer )();
228
-
229
- if (['php ' => 0 ] === $ updateAllowList ) {
230
- $ this ->dryRun = true ; // prevent recipes from being uninstalled when removing a pack
231
- }
232
224
}
233
225
234
226
if (isset ($ trace ['object ' ]) && $ trace ['object ' ] instanceof GlobalCommand) {
@@ -254,7 +246,6 @@ public function configureProject(Event $event)
254
246
$ file = Factory::getComposerFile ();
255
247
$ contents = file_get_contents ($ file );
256
248
$ manipulator = new JsonManipulator ($ contents );
257
- $ json = JsonFile::parseJson ($ contents );
258
249
259
250
// new projects are most of the time proprietary
260
251
$ manipulator ->addMainKey ('license ' , 'proprietary ' );
@@ -351,7 +342,7 @@ public function update(Event $event, $operations = [])
351
342
352
343
file_put_contents ($ file , $ manipulator ->getContents ());
353
344
354
- $ this ->reinstall ($ event, true );
345
+ $ this ->reinstall ($ event );
355
346
}
356
347
357
348
public function install (Event $ event )
@@ -738,7 +729,7 @@ private function formatOrigin(Recipe $recipe): string
738
729
739
730
private function shouldRecordOperation (OperationInterface $ operation , bool $ isDevMode , ?Composer $ composer = null ): bool
740
731
{
741
- if ($ this ->dryRun || $ this -> reinstall ) {
732
+ if ($ this ->reinstall ) {
742
733
return false ;
743
734
}
744
735
@@ -794,31 +785,29 @@ private function unpack(Event $event)
794
785
}
795
786
}
796
787
797
- $ unpacker = new Unpacker ($ this ->composer , new PackageResolver ($ this ->downloader ), $ this -> dryRun );
788
+ $ unpacker = new Unpacker ($ this ->composer , new PackageResolver ($ this ->downloader ));
798
789
$ result = $ unpacker ->unpack ($ unpackOp );
799
790
800
791
if (!$ result ->getUnpacked ()) {
801
792
return ;
802
793
}
803
794
804
- $ this ->io ->writeError ('<info>Unpacking Symfony packs</> ' );
805
795
foreach ($ result ->getUnpacked () as $ pkg ) {
806
796
$ this ->io ->writeError (\sprintf (' - Unpacked <info>%s</> ' , $ pkg ->getName ()));
807
797
}
808
798
809
799
$ unpacker ->updateLock ($ result , $ this ->io );
810
-
811
- $ this ->reinstall ($ event , false );
812
800
}
813
801
814
- private function reinstall (Event $ event, bool $ update )
802
+ private function reinstall (Event $ event )
815
803
{
816
804
$ this ->reinstall = false ;
817
805
$ event ->stopPropagation ();
818
806
819
807
$ ed = $ this ->composer ->getEventDispatcher ();
820
808
$ disableScripts = !method_exists ($ ed , 'setRunScripts ' ) || !((array ) $ ed )["\0* \0runScripts " ];
821
809
$ composer = Factory::create ($ this ->io , null , false , $ disableScripts );
810
+ $ composer ->getInstallationManager ()->addInstaller (new SymfonyPackInstaller ($ this ->io ));
822
811
823
812
$ installer = clone $ this ->installer ;
824
813
$ installer ->__construct (
@@ -836,10 +825,6 @@ private function reinstall(Event $event, bool $update)
836
825
$ installer ->setPlatformRequirementFilter (((array ) $ this ->installer )["\0* \0platformRequirementFilter " ]);
837
826
}
838
827
839
- if (!$ update ) {
840
- $ installer ->setUpdateAllowList (['php ' ]);
841
- }
842
-
843
828
$ installer ->run ();
844
829
845
830
$ this ->io ->write ($ this ->postInstallOutput );
0 commit comments