@@ -515,9 +515,7 @@ public static function postInstallCmd($installerInfo, $event) {
515
515
*/
516
516
public static function postUpdateCmd ($ installerInfo , $ event ) {
517
517
518
- if ($ installerInfo ["packagesRemove " ]) {
519
- self ::packagesRemove ($ installerInfo );
520
- } else {
518
+ if (!$ installerInfo ["packagesRemove " ]) {
521
519
self ::packagesInstall ($ installerInfo );
522
520
}
523
521
@@ -638,31 +636,25 @@ protected static function packagesInstall($installerInfo) {
638
636
639
637
/**
640
638
* Handle some Pattern Lab specific tasks based on what's found in the package's composer.json file on uninstall
641
- * @param {Array} the info culled from installing various pattern lab-related packages
639
+ * @param {Array} the info culled from a pattern lab-related package that's being removed
642
640
*/
643
- public static function packagesRemove ( $ installerInfo ) {
641
+ public static function packageRemove ( $ packageInfo ) {
644
642
645
643
// run the console and config inits
646
644
self ::init ();
647
645
648
- $ packages = $ installerInfo ["packages " ];
646
+ // see if the package has a listener and remove it
647
+ self ::scanForListener ($ packageInfo ["pathBase " ],true );
649
648
650
- foreach ($ packages as $ package ) {
651
-
652
- // see if the package has a listener and remove it
653
- self ::scanForListener ($ pathBase ,true );
654
-
655
- // see if the package is a pattern engine and remove the rule
656
- if ($ type == "patternlab-patternengine " ) {
657
- self ::scanForPatternEngineRule ($ pathBase ,true );
658
- }
659
-
660
- // remove the component package file if it exists
661
- $ jsonFile = Config::getOption ("componentDir " )."/packages/ " .str_replace ("/ " ,"- " ,$ name ).".json " ;
662
- if (file_exists ($ jsonFile )) {
663
- unlink ($ jsonFile );
664
- }
665
-
649
+ // see if the package is a pattern engine and remove the rule
650
+ if ($ packageInfo ["type " ] == "patternlab-patternengine " ) {
651
+ self ::scanForPatternEngineRule ($ packageInfo ["pathBase " ],true );
652
+ }
653
+
654
+ // remove the component package file if it exists
655
+ $ jsonFile = Config::getOption ("componentDir " )."/packages/ " .str_replace ("/ " ,"- " ,$ packageInfo ["name " ]).".json " ;
656
+ if (file_exists ($ jsonFile )) {
657
+ unlink ($ jsonFile );
666
658
}
667
659
668
660
}
0 commit comments