Commit 77a0ae02 authored by Christian Kuhn's avatar Christian Kuhn Committed by Wouter Wolters
Browse files

[BUGFIX] Clean up install tool cardsAction

With the install tool "make all modals" rewrite in #84772,
the initial views are stupid and don't need fluid assignments
like tokens anymore: Card details are now handled in single
"getContent" actions per card.
Left over assignments are removed with the patch.
Furthermore, the core updater getContent action entirely missed
some fluid assignments and the "search in custom path" image
preset functionality is restored.

Resolves: #85676
Resolves: #85419
Related: #84772
Releases: master
Change-Id: I4b2054338b500d4f8d08f83f76a3efc66511a529
Reviewed-on: https://review.typo3.org/57715


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog's avatarSusanne Moog <susanne.moog@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent d4ca073b
......@@ -50,24 +50,6 @@ class EnvironmentController extends AbstractController
public function cardsAction(ServerRequestInterface $request): ResponseInterface
{
$view = $this->initializeStandaloneView($request, 'Environment/Cards.html');
$formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
$view->assignMultiple([
'imageProcessingProcessor' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor'] === 'GraphicsMagick' ? 'GraphicsMagick' : 'ImageMagick',
'imageProcessingEnabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'],
'imageProcessingPath' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path'],
'imageProcessingVersion' => $this->determineImageMagickVersion(),
'imageProcessingEffects' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_effects'],
'imageProcessingGdlibEnabled' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib'],
'imageProcessingGdlibPng' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib_png'],
'imageProcessingFileFormats' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'mailTestToken' => $formProtection->generateToken('installTool', 'mailTest'),
'mailTestSenderAddress' => $this->getSenderEmailAddress(),
'systemInformationCgiDetected', GeneralUtility::isRunningOnCgiServerApi(),
'systemInformationDatabaseConnections' => $this->getDatabaseConnectionInformation(),
'systemInformationOperatingSystem' => Environment::isWindows() ? 'Windows' : 'Unix',
]);
return new JsonResponse([
'success' => true,
'html' => $view->render(),
......
......@@ -52,18 +52,6 @@ class MaintenanceController extends AbstractController
public function cardsAction(ServerRequestInterface $request): ResponseInterface
{
$view = $this->initializeStandaloneView($request, 'Maintenance/Cards.html');
$formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
$view->assignMultiple([
'clearAllCacheOpcodeCaches' => (new OpcodeCacheService())->getAllActive(),
'clearTablesClearToken' => $formProtection->generateToken('installTool', 'clearTablesClear'),
'clearTypo3tempFilesToken' => $formProtection->generateToken('installTool', 'clearTypo3tempFiles'),
'createAdminToken' => $formProtection->generateToken('installTool', 'createAdmin'),
'databaseAnalyzerExecuteToken' => $formProtection->generateToken('installTool', 'databaseAnalyzerExecute'),
'languagePacksActivateLanguageToken' => $formProtection->generateToken('installTool', 'languagePacksActivateLanguage'),
'languagePacksDeactivateLanguageToken' => $formProtection->generateToken('installTool', 'languagePacksDeactivateLanguage'),
'languagePacksUpdatePackToken' => $formProtection->generateToken('installTool', 'languagePacksUpdatePack'),
'languagePacksUpdateIsoTimesToken' => $formProtection->generateToken('installTool', 'languagePacksUpdateIsoTimes'),
]);
return new JsonResponse([
'success' => true,
'html' => $view->render(),
......
......@@ -50,13 +50,6 @@ class SettingsController extends AbstractController
public function cardsAction(ServerRequestInterface $request): ResponseInterface
{
$view = $this->initializeStandaloneView($request, 'Settings/Cards.html');
$formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
$view->assignMultiple([
'changeInstallToolPasswordToken' => $formProtection->generateToken('installTool', 'changeInstallToolPassword'),
'presetGetContentToken' => $formProtection->generateToken('installTool', 'presetsGetContent'),
'systemMaintainerWriteToken' => $formProtection->generateToken('installTool', 'systemMaintainerWrite'),
'systemMaintainerIsDevelopmentContext' => GeneralUtility::getApplicationContext()->isDevelopment(),
]);
return new JsonResponse([
'success' => true,
'html' => $view->render(),
......@@ -133,6 +126,7 @@ class SettingsController extends AbstractController
$formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
$view->assignMultiple([
'systemMaintainerWriteToken' => $formProtection->generateToken('installTool', 'systemMaintainerWrite'),
'systemMaintainerIsDevelopmentContext' => GeneralUtility::getApplicationContext()->isDevelopment(),
]);
$connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
......@@ -298,6 +292,8 @@ class SettingsController extends AbstractController
$formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
$view->assignMultiple([
'presetsActivateToken' => $formProtection->generateToken('installTool', 'presetsActivate'),
// This action is called again from within the card itself if a custom image path is supplied
'presetsGetContentToken' => $formProtection->generateToken('installTool', 'presetsGetContent'),
'presetFeatures' => $presetFeatures,
]);
return new JsonResponse([
......
......@@ -170,23 +170,6 @@ class UpgradeController extends AbstractController
public function cardsAction(ServerRequestInterface $request): ResponseInterface
{
$view = $this->initializeStandaloneView($request, 'Upgrade/Cards.html');
$coreUpdateService = GeneralUtility::makeInstance(CoreUpdateService::class);
$coreVersionService = GeneralUtility::makeInstance(CoreVersionService::class);
$formProtection = FormProtectionFactory::get(InstallToolFormProtection::class);
$view->assignMultiple([
'extensionCompatTesterLoadExtLocalconfToken' => $formProtection->generateToken('installTool', 'extensionCompatTesterLoadExtLocalconf'),
'extensionCompatTesterLoadExtTablesToken' => $formProtection->generateToken('installTool', 'extensionCompatTesterLoadExtTables'),
'extensionCompatTesterUninstallToken' => $formProtection->generateToken('installTool', 'extensionCompatTesterUninstallExtension'),
'coreUpdateEnabled' => $coreUpdateService->isCoreUpdateEnabled(),
'coreUpdateComposerMode' => Environment::isComposerMode(),
'coreUpdateIsReleasedVersion' => $coreVersionService->isInstalledVersionAReleasedVersion(),
'coreUpdateIsSymLinkedCore' => is_link(Environment::getPublicPath() . '/typo3_src'),
'upgradeWizardsMarkUndoneToken' => $formProtection->generateToken('installTool', 'upgradeWizardsMarkUndone'),
'upgradeWizardsInputToken' => $formProtection->generateToken('installTool', 'upgradeWizardsInput'),
'upgradeWizardsExecuteToken' => $formProtection->generateToken('installTool', 'upgradeWizardsExecute'),
]);
return new JsonResponse([
'success' => true,
'html' => $view->render(),
......@@ -247,6 +230,14 @@ class UpgradeController extends AbstractController
public function coreUpdateGetDataAction(ServerRequestInterface $request): ResponseInterface
{
$view = $this->initializeStandaloneView($request, 'Upgrade/CoreUpdate.html');
$coreUpdateService = GeneralUtility::makeInstance(CoreUpdateService::class);
$coreVersionService = GeneralUtility::makeInstance(CoreVersionService::class);
$view->assignMultiple([
'coreUpdateEnabled' => $coreUpdateService->isCoreUpdateEnabled(),
'coreUpdateComposerMode' => Environment::isComposerMode(),
'coreUpdateIsReleasedVersion' => $coreVersionService->isInstalledVersionAReleasedVersion(),
'coreUpdateIsSymLinkedCore' => is_link(Environment::getPublicPath() . '/typo3_src'),
]);
return new JsonResponse([
'success' => true,
'html' => $view->render(),
......
......@@ -10,7 +10,7 @@
Changed values are written to LocalConfiguration.php. The optional file AdditionalConfiguration.php is not controlled by the TYPO3’s core and may override certain settings. Administrators must maintain AdditionalConfiguration.php manually and should be used with caution.
</p>
<div class="t3js-presets-content" data-presets-activate-token="{presetsActivateToken}">
<div class="t3js-presets-content" data-presets-activate-token="{presetsActivateToken}" data-presets-content-token="{presetsGetContentToken}">
<form method="post" class="form-horizontal">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<f:for each="{presetFeatures}" as="feature">
......
......@@ -38,10 +38,10 @@ define([
this.currentModal = currentModal;
self.getContent();
// Load content on click image executable path button
// Load content with post data on click 'custom image executable path'
currentModal.on('click', this.selectorImageExecutableTrigger, function(e) {
e.preventDefault();
self.getContent();
self.getCustomImagePathContent();
});
// Write out selected preset
......@@ -75,6 +75,38 @@ define([
});
},
getCustomImagePathContent: function() {
var self = this;
var modalContent = this.currentModal.find(self.selectorModalBody);
var presetsContentToken = self.currentModal.find(this.selectorModuleContent).data('presets-content-token');
$.ajax({
url: Router.getUrl(),
method: 'POST',
data: {
'install': {
'token': presetsContentToken,
'action': 'presetsGetContent',
'values': {
'Image': {
'additionalSearchPath': self.currentModal.find(this.selectorImageExecutable).val()
}
}
}
},
cache: false,
success: function(data) {
if (data.success === true && data.html !== 'undefined' && data.html.length > 0) {
modalContent.empty().append(data.html);
} else {
Notification.error('Something went wrong');
}
},
error: function(xhr) {
Router.handleAjaxError(xhr);
}
});
},
activate: function() {
var self = this;
var executeToken = self.currentModal.find(this.selectorModuleContent).data('presets-activate-token');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment