From b4be1840b57c0121ace8ed688e1f82df6716d14b Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Wed, 13 Jul 2011 23:03:05 +0200 Subject: [PATCH] [BUGFIX] Fix front end redirect to 1-2-3 installer An empty value in the TYPO3_db constant indicates a not configured installation in the front end. The front end then redirects to 1-2-3 installer. This broke with change 89732c4a of #27954 because the check for db constant is done too late. Change the order of the checks during database connection and check if the TYPO3_db constant has a value first. Change-Id: I0a7003d876a747e16552fecf6385b0449de5617a Resolves: #28185 Related: #27954 Reviewed-on: http://review.typo3.org/3316 Reviewed-by: Helmut Hummel Tested-by: Helmut Hummel Reviewed-by: Stefan Neufeind Reviewed-by: Markus Klein Tested-by: Markus Klein Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- t3lib/class.t3lib_db.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/t3lib/class.t3lib_db.php b/t3lib/class.t3lib_db.php index d9a21073fda9..3d614e42d4cd 100644 --- a/t3lib/class.t3lib_db.php +++ b/t3lib/class.t3lib_db.php @@ -1339,13 +1339,17 @@ class t3lib_DB { * @return void */ function connectDB($host = TYPO3_db_host, $user = TYPO3_db_username, $password = TYPO3_db_password, $db = TYPO3_db) { + // If no db is given we throw immediately. This is a sign for a fresh (not configured) + // TYPO3 installation and is used in FE to redirect to 1-2-3 install tool + if (!$db) { + throw new RuntimeException( + 'TYPO3 Fatal Error: No database selected!', + 1270853882 + ); + } + if ($this->sql_pconnect($host, $user, $password)) { - if (!$db) { - throw new RuntimeException( - 'TYPO3 Fatal Error: No database selected!', - 1270853882 - ); - } elseif (!$this->sql_select_db($db)) { + if (!$this->sql_select_db($db)) { throw new RuntimeException( 'TYPO3 Fatal Error: Cannot connect to the current database, "' . $db . '"!', 1270853883 -- 2.20.1