Skip to content

Commit d66b57f

Browse files
committed
reworking the uninstall stuff again
1 parent 82375c3 commit d66b57f

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

src/PatternLab/InstallerUtil.php

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -515,9 +515,7 @@ public static function postInstallCmd($installerInfo, $event) {
515515
*/
516516
public static function postUpdateCmd($installerInfo, $event) {
517517

518-
if ($installerInfo["packagesRemove"]) {
519-
self::packagesRemove($installerInfo);
520-
} else {
518+
if (!$installerInfo["packagesRemove"]) {
521519
self::packagesInstall($installerInfo);
522520
}
523521

@@ -638,31 +636,25 @@ protected static function packagesInstall($installerInfo) {
638636

639637
/**
640638
* 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
642640
*/
643-
public static function packagesRemove($installerInfo) {
641+
public static function packageRemove($packageInfo) {
644642

645643
// run the console and config inits
646644
self::init();
647645

648-
$packages = $installerInfo["packages"];
646+
// see if the package has a listener and remove it
647+
self::scanForListener($packageInfo["pathBase"],true);
649648

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);
666658
}
667659

668660
}

0 commit comments

Comments
 (0)