|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
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
|
|
|
namespace TYPO3\CMS\Install\Controller; |
|
19
|
|
|
|
|
20
|
|
|
use Psr\Http\Message\ServerRequestInterface; |
|
21
|
|
|
use TYPO3\CMS\Core\Core\Environment; |
|
22
|
|
|
use TYPO3\CMS\Core\Information\Typo3Version; |
|
23
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
24
|
|
|
use TYPO3\CMS\Fluid\View\StandaloneView; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Controller abstract for shared parts of the install tool |
|
28
|
|
|
* @internal This class is a specific controller implementation and is not considered part of the Public TYPO3 API. |
|
29
|
|
|
*/ |
|
30
|
|
|
class AbstractController |
|
31
|
|
|
{ |
|
32
|
|
|
/** |
|
33
|
|
|
* Helper method to initialize a standalone view instance. |
|
34
|
|
|
* |
|
35
|
|
|
* @param ServerRequestInterface $request |
|
36
|
|
|
* @param string $templatePath |
|
37
|
|
|
* @return StandaloneView |
|
38
|
|
|
* @internal param string $template |
|
39
|
|
|
*/ |
|
40
|
|
|
protected function initializeStandaloneView(ServerRequestInterface $request, string $templatePath): StandaloneView |
|
41
|
|
|
{ |
|
42
|
|
|
$viewRootPath = GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/'); |
|
43
|
|
|
$view = GeneralUtility::makeInstance(StandaloneView::class); |
|
44
|
|
|
$view->getRequest()->setControllerExtensionName('Install'); |
|
45
|
|
|
$view->setTemplatePathAndFilename($viewRootPath . 'Templates/' . $templatePath); |
|
46
|
|
|
$view->setLayoutRootPaths([$viewRootPath . 'Layouts/']); |
|
47
|
|
|
$view->setPartialRootPaths([$viewRootPath . 'Partials/']); |
|
48
|
|
|
$view->assignMultiple([ |
|
49
|
|
|
'controller' => $request->getQueryParams()['install']['controller'] ?? 'maintenance', |
|
50
|
|
|
'context' => $request->getQueryParams()['install']['context'] ?? '', |
|
51
|
|
|
'composerMode' => Environment::isComposerMode(), |
|
52
|
|
|
'currentTypo3Version' => (string)(new Typo3Version()) |
|
53
|
|
|
]); |
|
54
|
|
|
return $view; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|