public function createSitePackageAction($packageKey, $siteName)
{
if ($this->packageManager->isPackageActive('Neos.SiteKickstarter') === false) {
$this->addFlashMessage('The package "%s" is required to create new site packages.', 'Missing Package', Message::SEVERITY_ERROR, array('Neos.SiteKickstarter'), 1475736232);
$this->redirect('index');
}
if ($this->packageManager->isPackageAvailable($packageKey)) {
$this->addFlashMessage('The package key "%s" already exists.', 'Invalid package key', Message::SEVERITY_ERROR, array(htmlspecialchars($packageKey)), 1412372021);
$this->redirect('index');
}
$generatorService = $this->objectManager->get(GeneratorService::class);
$generatorService->generateSitePackage($packageKey, $siteName);
$this->flashMessageContainer->addMessage(new Message(sprintf('Site Packages "%s" was created.', htmlspecialchars($packageKey))));
$deactivatedSitePackages = $this->deactivateAllOtherSitePackages($packageKey);
if (count($deactivatedSitePackages) > 0) {
$this->flashMessageContainer->addMessage(new Message(sprintf('The existing Site Packages "%s" were deactivated, in order to prevent interactions with the newly created package "%s".', htmlspecialchars(implode(', ', $deactivatedSitePackages)), htmlspecialchars($packageKey))));
}
$this->packageManager->activatePackage($packageKey);
$this->forward('importSite', null, null, ['packageKey' => $packageKey]);
}