/**
  * Unfreeze a package
  *
  * Unfreezes a previously frozen package. On the next request, this package will
  * be considered again by the file monitoring and related services – if they are
  * enabled in the current context.
  *
  * By specifying <b>all</b> as a package key, all currently frozen packages are
  * unfrozen (the default).
  *
  * @param string $packageKey Key of the package to unfreeze, or 'all'
  * @return void
  * @see typo3.flow3:package:freeze
  * @see typo3.flow3:cache:flush
  */
 public function unfreezeCommand($packageKey = 'all')
 {
     if (!$this->bootstrap->getContext()->isDevelopment()) {
         $this->outputLine('Package freezing is only supported in Development context.');
         $this->quit(3);
     }
     $packagesToUnfreeze = array();
     if ($packageKey === 'all') {
         foreach (array_keys($this->packageManager->getAvailablePackages()) as $packageKey) {
             if ($this->packageManager->isPackageFrozen($packageKey)) {
                 $packagesToUnfreeze[] = $packageKey;
             }
         }
         if ($packagesToUnfreeze === array()) {
             $this->outputLine('Nothing to do, no packages were frozen.');
             $this->quit(0);
         }
     } else {
         if ($packageKey === NULL) {
             $this->outputLine('You must specify a package to unfreeze.');
             $this->quit(1);
         }
         if (!$this->packageManager->isPackageAvailable($packageKey)) {
             $this->outputLine('Package "%s" is not available.', array($packageKey));
             $this->quit(2);
         }
         if (!$this->packageManager->isPackageFrozen($packageKey)) {
             $this->outputLine('Package "%s" was not frozen.', array($packageKey));
             $this->quit(0);
         }
         $packagesToUnfreeze = array($packageKey);
     }
     foreach ($packagesToUnfreeze as $packageKey) {
         $this->packageManager->unfreezePackage($packageKey);
         $this->outputLine('Unfroze package "%s".', array($packageKey));
     }
 }
 /**
  * @param array $packageKeys
  * @param string $action
  * @return void
  * @throws \RuntimeException
  */
 public function batchAction(array $packageKeys, $action)
 {
     switch ($action) {
         case 'freeze':
             $frozenPackages = array();
             foreach ($packageKeys as $packageKey) {
                 $message = $this->freezePackage($packageKey);
                 if ($message instanceof \TYPO3\FLOW3\Error\Error || $message instanceof \TYPO3\FLOW3\Error\Warning) {
                     $this->flashMessageContainer->addMessage($message);
                 } else {
                     array_push($frozenPackages, $packageKey);
                 }
             }
             if (count($frozenPackages) > 0) {
                 $message = new \TYPO3\FLOW3\Error\Message('Following packages have been frozen: ' . implode(', ', $frozenPackages));
             } else {
                 $message = new \TYPO3\FLOW3\Error\Warning('Unable to freeze the selected packages');
             }
             break;
         case 'unfreeze':
             foreach ($packageKeys as $packageKey) {
                 $this->packageManager->unfreezePackage($packageKey);
             }
             $message = new \TYPO3\FLOW3\Error\Message('Following packages have been unfrozen: ' . implode(', ', $packageKeys));
             break;
         case 'activate':
             $activatedPackages = array();
             foreach ($packageKeys as $packageKey) {
                 $message = $this->activatePackage($packageKey);
                 if ($message instanceof \TYPO3\FLOW3\Error\Error || $message instanceof \TYPO3\FLOW3\Error\Warning) {
                     $this->flashMessageContainer->addMessage($message);
                 } else {
                     array_push($activatedPackages, $packageKey);
                 }
             }
             if (count($activatedPackages) > 0) {
                 $message = new \TYPO3\FLOW3\Error\Message('Following packages have been activated: ' . implode(', ', $activatedPackages));
             } else {
                 $message = new \TYPO3\FLOW3\Error\Warning('Unable to activate the selected packages');
             }
             break;
         case 'deactivate':
             $deactivatedPackages = array();
             foreach ($packageKeys as $packageKey) {
                 $message = $this->deactivatePackage($packageKey);
                 if ($message instanceof \TYPO3\FLOW3\Error\Error || $message instanceof \TYPO3\FLOW3\Error\Warning) {
                     $this->flashMessageContainer->addMessage($message);
                 } else {
                     array_push($deactivatedPackages, $packageKey);
                 }
             }
             if (count($deactivatedPackages) > 0) {
                 $message = new \TYPO3\FLOW3\Error\Message('Following packages have been deactivated: ' . implode(', ', $deactivatedPackages));
             } else {
                 $message = new \TYPO3\FLOW3\Error\Warning('Unable to deactivate the selected packages');
             }
             break;
         case 'delete':
             $deletedPackages = array();
             foreach ($packageKeys as $packageKey) {
                 $message = $this->deletePackage($packageKey);
                 if ($message instanceof \TYPO3\FLOW3\Error\Error || $message instanceof \TYPO3\FLOW3\Error\Warning) {
                     $this->flashMessageContainer->addMessage($message);
                 } else {
                     array_push($deletedPackages, $packageKey);
                 }
             }
             if (count($deletedPackages) > 0) {
                 $message = new \TYPO3\FLOW3\Error\Message('Following packages have been deleted: ' . implode(', ', $deletedPackages));
             } else {
                 $message = new \TYPO3\FLOW3\Error\Warning('Unable to delete the selected packages');
             }
             break;
         default:
             throw new \RuntimeException('Invalid action "' . $action . '" given.', 1347463918);
     }
     $this->flashMessageContainer->addMessage($message);
     $this->redirect('index');
 }