[TASK] Doctrine: Migrate install tool class ImportantActions 74/49274/3
authorMarkus Hoelzle <typo3@markus-hoelzle.de>
Mon, 1 Aug 2016 08:54:55 +0000 (10:54 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 1 Aug 2016 11:53:22 +0000 (13:53 +0200)
Change-Id: Ibadb9f50a53f4cd66a7e55d9dd653bf2c75f07af
Resolves: #77319
Releases: master
Reviewed-on: https://review.typo3.org/49274
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php

index 38150e9..eb21264 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Tool;
 
 use TYPO3\CMS\Core\Core\Bootstrap;
 use TYPO3\CMS\Core\Crypto\Random;
 
 use TYPO3\CMS\Core\Core\Bootstrap;
 use TYPO3\CMS\Core\Crypto\Random;
+use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Service\OpcodeCacheService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Action;
 use TYPO3\CMS\Core\Service\OpcodeCacheService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Action;
@@ -226,12 +227,14 @@ class ImportantActions extends Action\AbstractAction
             $message->setTitle('Administrator user not created');
             $message->setMessage('Password must be at least eight characters long.');
         } else {
             $message->setTitle('Administrator user not created');
             $message->setMessage('Password must be at least eight characters long.');
         } else {
-            $database = $this->getDatabaseConnection();
-            $userExists = $database->exec_SELECTcountRows(
-                'uid',
-                'be_users',
-                'username=' . $database->fullQuoteStr($username, 'be_users')
-            );
+            $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
+            $userExists = $connectionPool->getConnectionForTable('be_users')
+                ->count(
+                    'uid',
+                    'be_users',
+                    ['username' => $username]
+                );
+
             if ($userExists) {
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
                 $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             if ($userExists) {
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
                 $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
@@ -246,7 +249,8 @@ class ImportantActions extends Action\AbstractAction
                     'tstamp' => $GLOBALS['EXEC_TIME'],
                     'crdate' => $GLOBALS['EXEC_TIME']
                 );
                     'tstamp' => $GLOBALS['EXEC_TIME'],
                     'crdate' => $GLOBALS['EXEC_TIME']
                 );
-                $database->exec_INSERTquery('be_users', $adminUserFields);
+                $connectionPool->getConnectionForTable('be_users')
+                    ->insert('be_users', $adminUserFields);
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
                 $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
                 $message->setTitle('Administrator created with username "' . $username . '".');
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
                 $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
                 $message->setTitle('Administrator created with username "' . $username . '".');