X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Finstaller.php;h=ff2bed1403adad3508dfe0847afe5b4e7aa8f923;hb=df562a1d8f4515462b190a214a4b6642f7855130;hp=d0e46f95c8fa82e887549b8b1d3155f7b8f027cd;hpb=ee438cf1980c859ea0ff15ea455434ac26f7c90e;p=quix0rs-gnu-social.git
diff --git a/lib/installer.php b/lib/installer.php
index d0e46f95c8..ff2bed1403 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -32,6 +32,7 @@
* @author Sarven Capadisli %s
chmod a+w %s
', INSTALLDIR));
@@ -341,7 +346,6 @@ abstract class Installer
* @param string $password
* @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
*/
function Mysql_Db_installer($host, $database, $username, $password)
@@ -349,14 +353,13 @@ abstract class Installer
$this->updateStatus("Starting installation...");
$this->updateStatus("Checking database...");
- $conn = mysql_connect($host, $username, $password);
- if (!$conn) {
+ $conn = mysqli_init();
+ if (!$conn->real_connect($host, $username, $password)) {
$this->updateStatus("Can't connect to server '$host' as '$username'.", true);
return false;
}
$this->updateStatus("Changing to database...");
- $res = mysql_select_db($database, $conn);
- if (!$res) {
+ if (!$conn->select_db($database)) {
$this->updateStatus("Can't change to database.", true);
return false;
}
@@ -411,6 +414,10 @@ abstract class Installer
"\$config['db']['database'] = '{$this->db['database']}';\n\n".
($this->db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":'').
"\$config['db']['type'] = '{$this->db['type']}';\n\n";
+
+ // Normalize line endings for Windows servers
+ $cfg = str_replace("\n", PHP_EOL, $cfg);
+
// write configuration file out to install directory
$res = file_put_contents(INSTALLDIR.'/config.php', $cfg);
@@ -438,9 +445,9 @@ abstract class Installer
// FIXME: use PEAR::DB or PDO instead of our own switch
switch ($type) {
case 'mysqli':
- $res = mysql_query($stmt, $conn);
+ $res = $conn->query($stmt);
if ($res === false) {
- $error = mysql_error();
+ $error = $conn->error;
}
break;
case 'pgsql':