[TASK] Use fully qualified name resolution in PHP 5.5
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Step / DatabaseConnect.php
index ee51478..9037eae 100644 (file)
@@ -1,28 +1,18 @@
 <?php
 namespace TYPO3\CMS\Install\Controller\Action\Step;
 
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+/**
+ * This file is part of the TYPO3 CMS project.
  *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
+ * 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.
  *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
  *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
+ * The TYPO3 project - inspiring people to share!
+ */
 
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 
@@ -46,7 +36,7 @@ class DatabaseConnect extends AbstractStepAction {
                $result = array();
 
                /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-               $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
+               $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
 
                $postValues = $this->postValues['values'];
                if (isset($postValues['loadDbal'])) {
@@ -101,7 +91,7 @@ class DatabaseConnect extends AbstractStepAction {
                                        $localConfigurationPathValuePairs['DB/username'] = $value;
                                } else {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Database username not valid');
                                        $errorStatus->setMessage('Given username must be shorter than fifty characters.');
                                        $result[] = $errorStatus;
@@ -114,7 +104,7 @@ class DatabaseConnect extends AbstractStepAction {
                                        $localConfigurationPathValuePairs['DB/password'] = $value;
                                } else {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Database password not valid');
                                        $errorStatus->setMessage('Given password must be shorter than fifty characters.');
                                        $result[] = $errorStatus;
@@ -127,7 +117,7 @@ class DatabaseConnect extends AbstractStepAction {
                                        $localConfigurationPathValuePairs['DB/host'] = $value;
                                } else {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Database host not valid');
                                        $errorStatus->setMessage('Given host is not alphanumeric (a-z, A-Z, 0-9 or _-.:) or longer than fifty characters.');
                                        $result[] = $errorStatus;
@@ -140,7 +130,7 @@ class DatabaseConnect extends AbstractStepAction {
                                        $localConfigurationPathValuePairs['DB/port'] = (int)$value;
                                } else {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Database port not valid');
                                        $errorStatus->setMessage('Given port is not numeric or within range 1 to 65535.');
                                        $result[] = $errorStatus;
@@ -152,7 +142,7 @@ class DatabaseConnect extends AbstractStepAction {
                                        $localConfigurationPathValuePairs['DB/socket'] = $postValues['socket'];
                                } else {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Socket does not exist');
                                        $errorStatus->setMessage('Given socket location does not exist on server.');
                                        $result[] = $errorStatus;
@@ -165,7 +155,7 @@ class DatabaseConnect extends AbstractStepAction {
                                        $localConfigurationPathValuePairs['DB/database'] = $value;
                                } else {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Database name not valid');
                                        $errorStatus->setMessage('Given database name must be shorter than fifty characters.');
                                        $result[] = $errorStatus;
@@ -183,13 +173,13 @@ class DatabaseConnect extends AbstractStepAction {
                                        ->disableCoreAndClassesCache();
                                if ($this->isDbalEnabled()) {
                                        require(ExtensionManagementUtility::extPath('dbal') . 'ext_localconf.php');
-                                       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
+                                       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
                                }
                                if (!$this->isConnectSuccessful()) {
                                        /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                                        $errorStatus->setTitle('Database connect not successful');
-                                       $errorStatus->setMessage('Connecting the database with given settings failed. Please check.');
+                                       $errorStatus->setMessage('Connecting to the database with given settings failed. Please check.');
                                        $result[] = $errorStatus;
                                }
                        }
@@ -202,7 +192,7 @@ class DatabaseConnect extends AbstractStepAction {
         * Step needs to be executed if database connection is not successful.
         *
         * @throws \TYPO3\CMS\Install\Controller\Exception\RedirectException
-        * @return boolean
+        * @return bool
         */
        public function needsExecution() {
                if ($this->isConnectSuccessful() && $this->isConfigurationComplete()) {
@@ -246,6 +236,7 @@ class DatabaseConnect extends AbstractStepAction {
                                ->assign('renderConnectDetailsPort', TRUE)
                                ->assign('renderConnectDetailsSocket', TRUE);
                }
+               $this->assignSteps();
 
                return $this->view->render();
        }
@@ -253,7 +244,7 @@ class DatabaseConnect extends AbstractStepAction {
        /**
         * Render connect port and label
         *
-        * @return integer Configured or default port
+        * @return int Configured or default port
         */
        protected function getConfiguredOrDefaultPort() {
                $configuredPort = (int)$this->getConfiguredPort();
@@ -286,11 +277,12 @@ class DatabaseConnect extends AbstractStepAction {
        /**
         * Test connection with given credentials
         *
-        * @return boolean TRUE if connect was successful
+        * @return bool TRUE if connect was successful
         */
        protected function isConnectSuccessful() {
                /** @var $databaseConnection \TYPO3\CMS\Core\Database\DatabaseConnection */
-               $databaseConnection = $this->objectManager->get('TYPO3\\CMS\\Core\\Database\\DatabaseConnection');
+               $databaseConnection = $this->objectManager->get(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+               $databaseConnection->initialize();
 
                if ($this->isDbalEnabled()) {
                        // Set additional connect information based on dbal driver. postgres for example needs
@@ -318,7 +310,7 @@ class DatabaseConnect extends AbstractStepAction {
         * - 'host' is mandatory and must not be empty
         * - 'port' OR 'socket' is mandatory, but may be empty
         *
-        * @return boolean TRUE if host is set
+        * @return bool TRUE if host is set
         */
        protected function isHostConfigured() {
                $hostConfigured = TRUE;
@@ -340,7 +332,7 @@ class DatabaseConnect extends AbstractStepAction {
         * - 'port' OR 'socket' is mandatory, but may be empty
         * - 'username' and 'password' are mandatory, but may be empty
         *
-        * @return boolean TRUE if required settings are present
+        * @return bool TRUE if required settings are present
         */
        protected function isConfigurationComplete() {
                $configurationComplete = $this->isHostConfigured();
@@ -402,7 +394,7 @@ class DatabaseConnect extends AbstractStepAction {
                }
 
                /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-               $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
+               $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
                $configurationManager->setLocalConfigurationValuesByPathValuePairs($localConfigurationPathValuePairs);
        }
 
@@ -410,7 +402,7 @@ class DatabaseConnect extends AbstractStepAction {
         * Test if a unix domain socket can be opened. This does not
         * authenticate but only tests if a connect is successful.
         *
-        * @return boolean TRUE on success
+        * @return bool TRUE on success
         */
        protected function isConnectionWithUnixDomainSocketPossible() {
                $result = FALSE;
@@ -569,7 +561,7 @@ class DatabaseConnect extends AbstractStepAction {
                        ExtensionManagementUtility::loadExtension('dbal');
                }
                /** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
-               $warningStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\WarningStatus');
+               $warningStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
                $warningStatus->setTitle('Loaded database abstraction layer');
                return $warningStatus;
        }
@@ -588,7 +580,7 @@ class DatabaseConnect extends AbstractStepAction {
                }
                // @TODO: Remove configuration from TYPO3_CONF_VARS['EXTCONF']['dbal']
                /** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
-               $warningStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\WarningStatus');
+               $warningStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
                $warningStatus->setTitle('Removed database abstraction layer');
                return $warningStatus;
        }
@@ -630,7 +622,7 @@ class DatabaseConnect extends AbstractStepAction {
        /**
         * Returns configured port. Gets port from host value if port is not yet set.
         *
-        * @return integer
+        * @return int
         */
        protected function getConfiguredPort() {
                $host = isset($GLOBALS['TYPO3_CONF_VARS']['DB']['host']) ? $GLOBALS['TYPO3_CONF_VARS']['DB']['host'] : '';