/**
  * Activates all packages that are configured in root composer.json or are required
  *
  * @param bool $removeInactivePackages
  */
 public function generatePackageStatesCommand($removeInactivePackages = FALSE)
 {
     try {
         $installationPackages = $this->getPackagesFromRootComposerFile();
     } catch (\Exception $e) {
         $this->outputLine('<error>' . $e->getMessage() . '</error>');
         $this->quit(1);
         return;
     }
     foreach ($this->packageManager->getAvailablePackages() as $package) {
         if (isset($installationPackages[$package->getPackageKey()]) || $package->isProtected() || $package instanceof Package && $package->isPartOfMinimalUsableSystem()) {
             $this->packageManager->activatePackage($package->getPackageKey());
         } else {
             try {
                 $this->packageManager->deactivatePackage($package->getPackageKey());
             } catch (\UnexpectedValueException $exception) {
                 $this->outputLine('<info>Error while deactivating package %s. Exception: %s</info>', array($package->getPackageKey(), $exception->getMessage()));
             }
             if ($removeInactivePackages) {
                 $this->packageManager->unregisterPackage($package);
                 GeneralUtility::flushDirectory($package->getPackagePath());
                 $this->outputLine('Removed Package: ' . $package->getPackageKey());
             }
         }
     }
     $this->packageManager->forceSortAndSavePackageStates();
 }
 /**
  * Activates all packages that are configured in root composer.json or are required
  *
  * @param bool $removeInactivePackages
  */
 public function generatePackageStatesCommand($removeInactivePackages = FALSE)
 {
     $installationPackages = $this->getPackagesFromRootComposerFile();
     foreach ($this->packageManager->getAvailablePackages() as $package) {
         if (in_array($package->getPackageKey(), $installationPackages) || $package->isProtected() || $package instanceof Package && $package->isPartOfMinimalUsableSystem()) {
             $this->packageManager->activatePackage($package->getPackageKey());
         } else {
             $this->packageManager->deactivatePackage($package->getPackageKey());
             if ($removeInactivePackages) {
                 $this->packageManager->unregisterPackage($package);
                 GeneralUtility::flushDirectory($package->getPackagePath());
                 $this->outputLine('Removed Package: ' . $package->getPackageKey());
             }
         }
     }
     $this->packageManager->forceSortAndSavePackageStates();
 }