[BUGFIX] Disable dump autoloading in Composer mode
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / AbstractController.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Install\Controller;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use Psr\Http\Message\ServerRequestInterface;
19 use TYPO3\CMS\Core\Core\Environment;
20 use TYPO3\CMS\Core\Utility\GeneralUtility;
21 use TYPO3\CMS\Fluid\View\StandaloneView;
22
23 /**
24 * Controller abstract for shared parts of the install tool
25 * @internal This class is a specific controller implementation and is not considered part of the Public TYPO3 API.
26 */
27 class AbstractController
28 {
29 /**
30 * Helper method to initialize a standalone view instance.
31 *
32 * @param ServerRequestInterface $request
33 * @param string $templatePath
34 * @return StandaloneView
35 * @internal param string $template
36 */
37 protected function initializeStandaloneView(ServerRequestInterface $request, string $templatePath): StandaloneView
38 {
39 $viewRootPath = GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/');
40 $view = GeneralUtility::makeInstance(StandaloneView::class);
41 $view->getRequest()->setControllerExtensionName('Install');
42 $view->setTemplatePathAndFilename($viewRootPath . 'Templates/' . $templatePath);
43 $view->setLayoutRootPaths([$viewRootPath . 'Layouts/']);
44 $view->setPartialRootPaths([$viewRootPath . 'Partials/']);
45 $view->assignMultiple([
46 'controller' => $request->getQueryParams()['install']['controller'] ?? 'maintenance',
47 'context' => $request->getQueryParams()['install']['context'] ?? '',
48 'composerMode' => Environment::isComposerMode(),
49 ]);
50 return $view;
51 }
52
53 /**
54 * Some actions like the database analyzer and the upgrade wizards need additional
55 * bootstrap actions performed.
56 *
57 * Those actions can potentially fatal if some old extension is loaded that triggers
58 * a fatal in ext_localconf or ext_tables code! Use only if really needed.
59 */
60 protected function loadExtLocalconfDatabaseAndExtTables()
61 {
62 \TYPO3\CMS\Core\Core\Bootstrap::loadTypo3LoadedExtAndExtLocalconf(false);
63 \TYPO3\CMS\Core\Core\Bootstrap::unsetReservedGlobalVariables();
64 \TYPO3\CMS\Core\Core\Bootstrap::loadBaseTca(false);
65 \TYPO3\CMS\Core\Core\Bootstrap::loadExtTables(false);
66 }
67 }