Skip to content
Snippets Groups Projects
Commit 44a3ca8b authored by Steven Wittens's avatar Steven Wittens
Browse files

#68926: Fix MySQLi installation (was not committed properly)

parent 71236a88
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -47,7 +47,7 @@ function drupal_test_mysqli($url, &$success) { ...@@ -47,7 +47,7 @@ function drupal_test_mysqli($url, &$success) {
// Test selecting the database. // Test selecting the database.
if (mysqli_connect_errno() > 0) { if (mysqli_connect_errno() > 0) {
drupal_set_message(st('We were able to connect to the MySQL database server (which means your username and password are valid) but not able to select your database. MySQL reports the following message: %error.<ul><li>Are you sure you have the correct database name?</li><li>Are you sure the database exists?</li><li>Are you sure the username has permission to access the database?</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' => mysqli_error())), 'error'); drupal_set_message(st('We were able to connect to the MySQL database server (which means your username and password are valid) but not able to select your database. MySQL reports the following message: %error.<ul><li>Are you sure you have the correct database name?</li><li>Are you sure the database exists?</li><li>Are you sure the username has permission to access the database?</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' => mysqli_error($connection))), 'error');
return FALSE; return FALSE;
} }
...@@ -55,8 +55,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -55,8 +55,8 @@ function drupal_test_mysqli($url, &$success) {
// Test CREATE. // Test CREATE.
$query = 'CREATE TABLE drupal_install_test (id int(1) NULL)'; $query = 'CREATE TABLE drupal_install_test (id int(1) NULL)';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to create a test table on your MySQL database server with the command %query. MySQL reports the following message: %error.<ul><li>Are you sure the configured username has the necessary MySQL permissions to create tables in the database?</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('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to create a test table on your MySQL database server with the command %query. MySQL reports the following message: %error.<ul><li>Are you sure the configured username has the necessary MySQL permissions to create tables in the database?</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('%query' => $query, '%error' => $error)), 'error');
return FALSE; return FALSE;
} }
...@@ -66,8 +66,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -66,8 +66,8 @@ function drupal_test_mysqli($url, &$success) {
// Test INSERT. // Test INSERT.
$query = 'INSERT INTO drupal_install_test (id) VALUES (1)'; $query = 'INSERT INTO drupal_install_test (id) VALUES (1)';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to insert a value into a test table on your MySQL database server. We tried inserting a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to insert a value into a test table on your MySQL database server. We tried inserting a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error');
$err = TRUE; $err = TRUE;
} }
...@@ -77,8 +77,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -77,8 +77,8 @@ function drupal_test_mysqli($url, &$success) {
// Test UPDATE. // Test UPDATE.
$query = 'UPDATE drupal_install_test SET id = 2'; $query = 'UPDATE drupal_install_test SET id = 2';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to update a value in a test table on your MySQL database server. We tried updating a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to update a value in a test table on your MySQL database server. We tried updating a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error');
$err = TRUE; $err = TRUE;
} }
...@@ -88,8 +88,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -88,8 +88,8 @@ function drupal_test_mysqli($url, &$success) {
// Test LOCK. // Test LOCK.
$query = 'LOCK TABLES drupal_install_test WRITE'; $query = 'LOCK TABLES drupal_install_test WRITE';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to lock a test table on your MySQL database server. We tried locking a table with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to lock a test table on your MySQL database server. We tried locking a table with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error');
$err = TRUE; $err = TRUE;
} }
...@@ -99,8 +99,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -99,8 +99,8 @@ function drupal_test_mysqli($url, &$success) {
// Test UNLOCK. // Test UNLOCK.
$query = 'UNLOCK TABLES'; $query = 'UNLOCK TABLES';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to unlock a test table on your MySQL database server. We tried unlocking a table with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to unlock a test table on your MySQL database server. We tried unlocking a table with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error');
$err = TRUE; $err = TRUE;
} }
...@@ -110,8 +110,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -110,8 +110,8 @@ function drupal_test_mysqli($url, &$success) {
// Test DELETE. // Test DELETE.
$query = 'DELETE FROM drupal_install_test'; $query = 'DELETE FROM drupal_install_test';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to delete a value from a test table on your MySQL database server. We tried deleting a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to delete a value from a test table on your MySQL database server. We tried deleting a value with the command %query and MySQL reported the following error: %error.', array('%query' => $query, '%error' => $error)), 'error');
$err = TRUE; $err = TRUE;
} }
...@@ -121,8 +121,8 @@ function drupal_test_mysqli($url, &$success) { ...@@ -121,8 +121,8 @@ function drupal_test_mysqli($url, &$success) {
// Test DROP. // Test DROP.
$query = 'DROP TABLE drupal_install_test'; $query = 'DROP TABLE drupal_install_test';
$result = mysqli_query($query); $result = mysqli_query($connection, $query);
if ($error = mysqli_error()) { if ($error = mysqli_error($connection)) {
drupal_set_message(st('We were unable to drop a test table from your MySQL database server. We tried dropping a table with the command %query and MySQL reported the following error %error.', array('%query' => $query, '%error' => $error)), 'error'); drupal_set_message(st('We were unable to drop a test table from your MySQL database server. We tried dropping a table with the command %query and MySQL reported the following error %error.', array('%query' => $query, '%error' => $error)), 'error');
$err = TRUE; $err = TRUE;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment