/**
  * @param string $packageKey
  * @return void
  */
 public function deleteAction($packageKey)
 {
     if ($this->packageManager->isPackageAvailable($packageKey) === false) {
         $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error('Package ' . $packageKey . ' does not exists.'));
         $this->redirect('index');
     }
     if ($this->packageManager->isPackageActive($packageKey) === true) {
         $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error('Package ' . $packageKey . ' is currently activated.'));
         $this->redirect('index');
     }
     $this->packageManager->deletePackage($packageKey);
     $this->redirect('index');
 }
 /**
  * Delete an existing package
  *
  * This command deletes an existing package identified by the package key.
  *
  * @Flow\FlushesCaches
  * @param string $packageKey The package key of the package to create
  * @return string
  */
 public function deleteCommand($packageKey)
 {
     if (!$this->packageManager->isPackageAvailable($packageKey)) {
         $this->outputLine('The package "%s" does not exist.', [$packageKey]);
         $this->quit(1);
     }
     $this->packageManager->deletePackage($packageKey);
     $this->outputLine('Deleted package "%s".', [$packageKey]);
     Scripts::executeCommand('typo3.flow:cache:flush', $this->settings, false);
     $this->sendAndExit(0);
 }
 /**
  * @param string $packageKey
  * @return Error|Message
  */
 protected function deletePackage($packageKey)
 {
     try {
         $this->packageManager->deletePackage($packageKey);
         $message = new Message('Package %s has been deleted', 1343231685, array($packageKey));
     } catch (UnknownPackageException $exception) {
         $message = new Error($exception->getMessage(), 1343231686);
     } catch (ProtectedPackageKeyException $exception) {
         $message = new Error($exception->getMessage(), 1343231687);
     } catch (Exception $exception) {
         $message = new Error($exception->getMessage(), 1343231688);
     }
     return $message;
 }