2 namespace TYPO3\CMS\Extbase\Core;
80 if (!isset($configuration[
'extensionName']) || $configuration[
'extensionName'] ===
'') {
81 throw new \RuntimeException(
'Invalid configuration: "extensionName" is not set', 1290623020);
83 if (!isset($configuration[
'pluginName']) || $configuration[
'pluginName'] ===
'') {
84 throw new \RuntimeException(
'Invalid configuration: "pluginName" is not set', 1290623027);
88 $this->initializeConfiguration($configuration);
103 $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
113 public function initializeConfiguration($configuration)
115 $this->configurationManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
117 $contentObject = isset($this->cObj) ? $this->cObj : \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
118 $this->configurationManager->setContentObject($contentObject);
119 $this->configurationManager->setConfiguration($configuration);
131 $frameworkSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
132 if (!is_array($frameworkSetup[
'objects'])) {
135 $objectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class);
136 foreach ($frameworkSetup[
'objects'] as $classNameWithDot => $classConfiguration) {
137 if (isset($classConfiguration[
'className'])) {
138 $originalClassName = rtrim($classNameWithDot,
'.');
139 $objectContainer->registerImplementation($originalClassName, $classConfiguration[
'className']);
152 $this->cacheManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class);
163 $this->reflectionService = $this->objectManager->get(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
164 $this->reflectionService->setDataCache($this->cacheManager->getCache(
'extbase_reflection'));
165 if (!$this->reflectionService->isInitialized()) {
166 $this->reflectionService->initialize();
178 $this->persistenceManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager::class);
190 public function run($content, $configuration)
193 return $this->handleRequest();
200 protected function handleRequest()
203 $requestHandlerResolver = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\RequestHandlerResolver::class);
204 $requestHandler = $requestHandlerResolver->resolveRequestHandler();
206 $response = $requestHandler->handleRequest();
211 $this->reflectionService->shutdown();
216 $this->objectManager->get(\TYPO3\CMS\Extbase\Service\CacheService::class)->clearCachesOfRegisteredPageIds();
218 throw new \TYPO3\CMS\Extbase\Mvc\Exception\CommandException(
'The request has been terminated as the response defined an exit code.',
$response->getExitCode());
232 $this->persistenceManager->persistAll();
233 $this->reflectionService->shutdown();
241 return (defined(
'TYPO3_cliMode') && TYPO3_cliMode);