Skip to content
Snippets Groups Projects
Commit 6b937f34 authored by Wouter Wolters's avatar Wouter Wolters Committed by Markus Klein
Browse files

[BUGFIX] Add upgrade wizard for backend user setting startModule

In #60633 the rewrite of the module menu was done but can lead
to an error if the backend user startModule is set
to help_aboutmodules. Check all backend users and update the
setting if needed.

Resolves: #61485
Releases: 6.3
Change-Id: Ib6f21c4bd4d4315e76cc7d51bebf08c9fa01b924
Reviewed-on: http://review.typo3.org/32692


Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarMarkus Klein <klein.t3@reelworx.at>
Tested-by: default avatarMarkus Klein <klein.t3@reelworx.at>
parent 3df6de75
No related merge requests found
<?php
namespace TYPO3\CMS\Install\Updates;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Update backend user setting startModule if set to "help_aboutmodules"
*
* @author Wouter Wolters <typo3@wouterwolters.nl>
*/
class BackendUserStartModuleUpdate extends AbstractUpdate {
/**
* @var string
*/
protected $title = 'Update backend user setting "startModule"';
/**
* Checks if an update is needed
*
* @param string &$description The description for the update
* @return boolean Whether an update is needed (TRUE) or not (FALSE)
*/
public function checkForUpdate(&$description) {
$backendUsersCount = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'be_users');
if ($this->isWizardDone() || $backendUsersCount === 0) {
return FALSE;
}
$description = 'The backend user setting startModule is changed for the extension aboutmodules. Update all backend users that use ext:aboutmodules as startModule.';
return TRUE;
}
/**
* Performs the database update if backend user's startmodule is help_aboutmodules
*
* @param array &$databaseQueries Queries done in this update
* @param mixed &$customMessages Custom messages
* @return boolean
*/
public function performUpdate(array &$databaseQueries, &$customMessages) {
$backendUsers = $this->getDatabaseConnection()->exec_SELECTgetRows('uid,uc', 'be_users', '1=1');
if (!empty($backendUsers)) {
foreach ($backendUsers as $backendUser) {
if ($backendUser['uc'] !== NULL) {
$userConfig = unserialize($backendUser['uc']);
if ($userConfig['startModule'] === 'help_aboutmodules') {
$userConfig['startModule'] = 'help_AboutmodulesAboutmodules';
$this->getDatabaseConnection()->exec_UPDATEquery(
'be_users',
'uid=' . (int)$backendUser['uid'],
array(
'uc' => serialize($userConfig),
)
);
$databaseQueries[] = $this->getDatabaseConnection()->debug_lastBuiltQuery;
}
}
}
}
$this->markWizardAsDone();
return TRUE;
}
/**
* Get database connection
*
* @return \TYPO3\CMS\Core\Database\DatabaseConnection
*/
protected function getDatabaseConnection() {
return $GLOBALS['TYPO3_DB'];
}
}
......@@ -22,6 +22,8 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['fal_identifi
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_rtemagicimages'] = 'TYPO3\\CMS\\Install\\Updates\\RteMagicImagesUpdateWizard';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['sysext_file_rtefilelinks'] = 'TYPO3\\CMS\\Install\\Updates\\RteFileLinksUpdateWizard';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['backendUserStartModule'] = 'TYPO3\\CMS\\Install\\Updates\\BackendUserStartModuleUpdate';
// Version 4.7: Migrate the flexforms of MediaElement
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['mediaElementFlexform'] = 'TYPO3\\CMS\\Install\\Updates\\MediaFlexformUpdate';
......
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