Skip to content

Commit

Permalink
[BUGFIX] Remove restrictions from SQL in InstallTool
Browse files Browse the repository at this point in the history
Since the context of the install tool can now be either standalone
or backend, SQL queries need to be adjusted so that Doctrine
restrictions don't change their results.

Resolves: #82360
Releases: master
Change-Id: Ic1934f06f73d6212d108658ad655228f2e983cc3
Reviewed-on: https://review.typo3.org/53976
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Matthias Vogel <typo3@kanti.de>
Tested-by: Matthias Vogel <typo3@kanti.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
  • Loading branch information
s2b authored and janhelke committed Sep 8, 2017
1 parent 949e4de commit 8ea2cea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ protected function executeAction(): array
}

$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
$queryBuilder->getRestrictions()->removeAll();

$validatedUserList = $queryBuilder
->select('uid')
->from('be_users')
Expand Down
9 changes: 6 additions & 3 deletions typo3/sysext/install/Classes/Updates/StartModuleUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class StartModuleUpdate extends AbstractUpdate
*/
public function checkForUpdate(&$description)
{
$statement = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('be_users')
->select(['uid', 'uc'], 'be_users', []);
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
$queryBuilder->getRestrictions()->removeAll();

$statement = $queryBuilder->select('uid', 'uc')->from('be_users')->execute();
$needsExecution = false;
while ($backendUser = $statement->fetch()) {
if ($backendUser['uc'] !== null) {
Expand Down Expand Up @@ -69,6 +70,7 @@ public function checkForUpdate(&$description)
public function performUpdate(array &$databaseQueries, &$customMessage)
{
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
$queryBuilder->getRestrictions()->removeAll();
$statement = $queryBuilder->select('uid', 'uc')->from('be_users')->execute();
while ($backendUser = $statement->fetch()) {
if ($backendUser['uc'] !== null) {
Expand All @@ -79,6 +81,7 @@ public function performUpdate(array &$databaseQueries, &$customMessage)
) {
$userConfig['startModule'] = 'help_AboutAbout';
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
$queryBuilder->getRestrictions()->removeAll();
$queryBuilder->update('be_users')
->where(
$queryBuilder->expr()->eq(
Expand Down

0 comments on commit 8ea2cea

Please sign in to comment.