[TASK] Get rid of ObjectManager in install tool
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Step / DatabaseSelect.php
index 43665b5..e892f0b 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Database select step.
  * This step is only rendered if database is mysql. With dbal,
@@ -38,7 +40,7 @@ class DatabaseSelect extends AbstractStepAction
         $postValues = $this->postValues['values'];
         $localConfigurationPathValuePairs = array();
         /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         if ($postValues['type'] === 'new') {
             $newDatabaseName = $postValues['new'];
             if ($this->isValidDatabaseName($newDatabaseName)) {
@@ -47,7 +49,7 @@ class DatabaseSelect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/database'] = $newDatabaseName;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Unable to create database');
                     $errorStatus->setMessage(
                         'Database with name ' . $newDatabaseName . ' could not be created.' .
@@ -59,7 +61,7 @@ class DatabaseSelect extends AbstractStepAction
                 }
             } else {
                 /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                 $errorStatus->setTitle('Database name not valid');
                 $errorStatus->setMessage(
                     'Given database name must be shorter than fifty characters' .
@@ -79,7 +81,7 @@ class DatabaseSelect extends AbstractStepAction
             }
         } else {
             /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-            $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $errorStatus->setTitle('No Database selected');
             $errorStatus->setMessage('You must select a database.');
             $result[] = $errorStatus;
@@ -123,7 +125,7 @@ class DatabaseSelect extends AbstractStepAction
     protected function executeAction()
     {
         /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $isInitialInstallationInProgress = $configurationManager->getConfigurationValueByPath('SYS/isInitialInstallationInProgress');
         $this->view->assign('databaseList', $this->getDatabaseList($isInitialInstallationInProgress));
         $this->view->assign('isInitialInstallationInProgress', $isInitialInstallationInProgress);
@@ -171,7 +173,7 @@ class DatabaseSelect extends AbstractStepAction
      */
     protected function initializeDatabaseConnection()
     {
-        $this->databaseConnection = $this->objectManager->get(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+        $this->databaseConnection = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $this->databaseConnection->setDatabaseUsername($GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
         $this->databaseConnection->setDatabasePassword($GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
         $this->databaseConnection->setDatabaseHost($GLOBALS['TYPO3_CONF_VARS']['DB']['host']);