Commit 880bb905 authored by Dries's avatar Dries

- Patch #202775 by michaelfavia, jabapyth: fixed database testing and error...

- Patch #202775 by michaelfavia, jabapyth: fixed database testing and error handling during installation.
parent 1931f3b9
...@@ -287,7 +287,7 @@ public function test() { ...@@ -287,7 +287,7 @@ public function test() {
return FALSE; return FALSE;
} }
foreach ($this->tests as $test) { foreach ($this->tests as $test) {
$return = $this->runTestQuery($test['query'], $test['success'], $test['message'], !empty($tests['fatal'])); $return = $this->runTestQuery($test['query'], $test['success'], $test['message'], !empty($test['fatal']));
if ($return === FALSE) { if ($return === FALSE) {
return FALSE; return FALSE;
} }
...@@ -303,11 +303,14 @@ public function test() { ...@@ -303,11 +303,14 @@ public function test() {
*/ */
protected function testConnect() { protected function testConnect() {
try { try {
// This doesn't actually test the connection.
db_set_active(); db_set_active();
// Now actually do a check.
Database::getConnection();
$this->success[] = 'CONNECT'; $this->success[] = 'CONNECT';
} }
catch (Exception $e) { catch (Exception $e) {
drupal_set_message(st('Failed to connect to your %name database server. %name reports the following message: %error.<ul><li>Are you sure you have the correct username and password?</li><li>Are you sure that you have typed the correct database hostname?</li><li>Are you sure that the database server is running?</li></ul>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%error' => $e->getMessage(), 'name' => $this->name())), 'error'); drupal_set_message(st('Failed to connect to your %name database server. %name reports the following message: <strong>%error</strong>.<ul><li>Are you sure that you have typed the correct database hostname?</li><li>Are you sure that the database server is running?</li><li>Are you sure you have the correct database name?</li><li>Are you sure you have the correct username and password?</li></ul>For more help, see the <a href="http://drupal.org/node/258">Installation and upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.', array('%error' => $e->getMessage(), '%name' => $this->name())), 'error');
return FALSE; return FALSE;
} }
} }
......
...@@ -267,7 +267,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting ...@@ -267,7 +267,7 @@ function install_settings_form(&$form_state, $profile, $install_locale, $setting
'#size' => 45, '#size' => 45,
); );
// Database username // Database password
$form['basic_options']['password'] = array( $form['basic_options']['password'] = array(
'#type' => 'password', '#type' => 'password',
'#title' => st('Database password'), '#title' => st('Database password'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment