[BUGFIX] Installer fails when no database is selected 44/26544/4
authorPhilipp Gampe <philipp.gampe@typo3.org>
Sun, 22 Dec 2013 15:02:12 +0000 (16:02 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Wed, 8 Jan 2014 23:07:42 +0000 (00:07 +0100)
Display an error message, if the selected database name is empty.

Resolves: #54569
Releases: 6.2
Change-Id: Idbf768d7edc0e5d5e1d0faf87d62e1060c70b1e9
Reviewed-on: https://review.typo3.org/26544
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Oliver Klee
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php
typo3/sysext/install/Resources/Private/Templates/Action/Step/DatabaseSelect.html

index 8a7d469..26b6e34 100644 (file)
@@ -63,7 +63,7 @@ class DatabaseSelect extends Action\AbstractAction implements StepInterface {
                                        $errorStatus->setMessage(
                                                'Database with name ' . $newDatabaseName . ' could not be created.' .
                                                ' Either your database name contains special chars (only alphanumeric characters are allowed)' .
-                                               ' or your database user probably has no sufficient permissions to create it.' .
+                                               ' or your database user probably does not have sufficient permissions to create it.' .
                                                ' Please choose an existing (empty) database or contact administration.'
                                        );
                                        $result[] = $errorStatus;
@@ -75,7 +75,7 @@ class DatabaseSelect extends Action\AbstractAction implements StepInterface {
                                $errorStatus->setMessage('Given database name must be shorter than fifty characters.');
                                $result[] = $errorStatus;
                        }
-               } elseif ($postValues['type'] === 'existing') {
+               } elseif ($postValues['type'] === 'existing' && !empty($postValues['existing'])) {
                        // Only store database information when it's empty
                        $this->databaseConnection->setDatabaseName($postValues['existing']);
                        $this->databaseConnection->sql_select_db();
@@ -84,6 +84,12 @@ class DatabaseSelect extends Action\AbstractAction implements StepInterface {
                        if (!$isInitialInstallation || count($existingTables) === 0) {
                                $localConfigurationPathValuePairs['DB/database'] = $postValues['existing'];
                        }
+               } else {
+                       /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
+                       $errorStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                       $errorStatus->setTitle('No Database selected');
+                       $errorStatus->setMessage('You have to select a database.');
+                       $result[] = $errorStatus;
                }
 
                if (!empty($localConfigurationPathValuePairs)) {
index c20b44a..1afe59d 100644 (file)
@@ -40,7 +40,7 @@
                                                                        name="install[values][existing]"
                                                                        onfocus="document.getElementById('t3-install-form-db-select-type-existing').checked=true;"
                                                                >
-                                                                       <option value="">Select database</option>
+                                                                       <option value="">-- Select database --</option>
                                                                        <f:for each="{databaseList}" as="database">
                                                                                <f:if condition="{database.tables}">
                                                                                        <f:then>