/** * Create a new package * * This command creates a new package which contains only the mandatory * directories and files. * * @FLOW3\FlushesCaches * @param string $packageKey The package key of the package to create * @return string * @see typo3.kickstart:kickstart:package */ public function createCommand($packageKey) { if (!$this->packageManager->isPackageKeyValid($packageKey)) { $this->outputLine('The package key "%s" is not valid.', array($packageKey)); $this->quit(1); } if ($this->packageManager->isPackageAvailable($packageKey)) { $this->outputLine('The package "%s" already exists.', array($packageKey)); $this->quit(1); } $package = $this->packageManager->createPackage($packageKey); $this->outputLine('Created new package "' . $packageKey . '" at "' . $package->getPackagePath() . '".'); }
/** * Action for creating a new package * * @param string $packageKey The package key of the package to create * @return string */ public function createAction($packageKey) { if ($packageKey === '') { return $this->helpAction(); } if (!$this->packageManager->isPackageKeyValid($packageKey)) { return 'The package key "' . $packageKey . '" is not valid.' . PHP_EOL; } if ($this->packageManager->isPackageAvailable($packageKey)) { return 'The package "' . $packageKey . '" already exists.' . PHP_EOL; } $package = $this->packageManager->createPackage($packageKey); return 'New package "' . $packageKey . '" created at "' . $package->getPackagePath() . '".' . PHP_EOL; }
/** * @param \TYPO3\Form\Core\Model\FinisherContext $finisherContext * @return void * @throws \TYPO3\Setup\Exception */ public function importSite(\TYPO3\Form\Core\Model\FinisherContext $finisherContext) { $formValues = $finisherContext->getFormRuntime()->getFormState()->getFormValues(); if (isset($formValues['prune']) && intval($formValues['prune']) === 1) { $this->nodeRepository->removeAll(); $this->workspaceRepository->removeAll(); $this->domainRepository->removeAll(); $this->siteRepository->removeAll(); $this->persistenceManager->persistAll(); } if (!empty($formValues['packageKey'])) { if ($this->packageManager->isPackageAvailable($formValues['packageKey'])) { throw new \TYPO3\Setup\Exception(sprintf('The package key "%s" already exists.', $formValues['packageKey']), 1346759486); } $packageKey = $formValues['packageKey']; $siteName = $formValues['packageKey']; $this->packageManager->createPackage($packageKey, NULL, Files::getUnixStylePath(Files::concatenatePaths(array(FLOW3_PATH_PACKAGES, 'Sites')))); $this->generatorService->generateSitesXml($packageKey, $siteName); $this->generatorService->generateSitesTypoScript($packageKey, $siteName); $this->generatorService->generateSitesTemplate($packageKey, $siteName); $this->packageManager->activatePackage($packageKey); } else { $packageKey = $formValues['site']; } if ($packageKey !== '') { try { $contentContext = new \TYPO3\TYPO3\Domain\Service\ContentContext('live'); $this->nodeRepository->setContext($contentContext); $this->siteImportService->importFromPackage($packageKey); } catch (\Exception $exception) { $finisherContext->cancel(); $this->flashMessageContainer->addMessage(new \TYPO3\FLOW3\Error\Error(sprintf('Error: During the import of the "Sites.xml" from the package "%s" an exception occurred: %s', $packageKey, $exception->getMessage()))); } } }