Test for and use mysqli in installer, since that's what we use later, rather than mysql.
This commit is contained in:
parent
2af12774bf
commit
32918bb7c1
|
@ -51,7 +51,7 @@ abstract class Installer
|
||||||
public static $dbModules = array(
|
public static $dbModules = array(
|
||||||
'mysql' => array(
|
'mysql' => array(
|
||||||
'name' => 'MySQL',
|
'name' => 'MySQL',
|
||||||
'check_module' => 'mysql', // mysqli?
|
'check_module' => 'mysqli',
|
||||||
'installer' => 'mysql_db_installer',
|
'installer' => 'mysql_db_installer',
|
||||||
),
|
),
|
||||||
'pgsql' => array(
|
'pgsql' => array(
|
||||||
|
@ -341,7 +341,6 @@ abstract class Installer
|
||||||
* @param string $password
|
* @param string $password
|
||||||
* @return mixed array of database connection params on success, false on failure
|
* @return mixed array of database connection params on success, false on failure
|
||||||
*
|
*
|
||||||
* @fixme be consistent about using mysqli vs mysql!
|
|
||||||
* @fixme escape things in the connection string in case we have a funny pass etc
|
* @fixme escape things in the connection string in case we have a funny pass etc
|
||||||
*/
|
*/
|
||||||
function Mysql_Db_installer($host, $database, $username, $password)
|
function Mysql_Db_installer($host, $database, $username, $password)
|
||||||
|
@ -349,14 +348,13 @@ abstract class Installer
|
||||||
$this->updateStatus("Starting installation...");
|
$this->updateStatus("Starting installation...");
|
||||||
$this->updateStatus("Checking database...");
|
$this->updateStatus("Checking database...");
|
||||||
|
|
||||||
$conn = mysql_connect($host, $username, $password);
|
$conn = mysqli_init();
|
||||||
if (!$conn) {
|
if (!$conn->real_connect($host, $username, $password)) {
|
||||||
$this->updateStatus("Can't connect to server '$host' as '$username'.", true);
|
$this->updateStatus("Can't connect to server '$host' as '$username'.", true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->updateStatus("Changing to database...");
|
$this->updateStatus("Changing to database...");
|
||||||
$res = mysql_select_db($database, $conn);
|
if (!$conn->select_db($database)) {
|
||||||
if (!$res) {
|
|
||||||
$this->updateStatus("Can't change to database.", true);
|
$this->updateStatus("Can't change to database.", true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -438,9 +436,9 @@ abstract class Installer
|
||||||
// FIXME: use PEAR::DB or PDO instead of our own switch
|
// FIXME: use PEAR::DB or PDO instead of our own switch
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'mysqli':
|
case 'mysqli':
|
||||||
$res = mysql_query($stmt, $conn);
|
$res = $conn->query($stmt);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
$error = mysql_error();
|
$error = $conn->error();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user