]> git.wh0rd.org Git - tt-rss.git/commitdiff
remove support for legacy mysql driver
authorAndrew Dolgov <noreply@fakecake.org>
Sun, 21 Aug 2016 11:03:35 +0000 (14:03 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sun, 21 Aug 2016 11:03:35 +0000 (14:03 +0300)
classes/db.php
classes/db/mysql.php [deleted file]
include/sanity_check.php
install/index.php

index 8d2f895160e8fc89329a1da63a4740b8499e0852..c7d6da910dd00a6fb93ee7a3caef3b72fe5242e4 100644 (file)
@@ -13,11 +13,7 @@ class Db implements IDb {
                } else {
                        switch (DB_TYPE) {
                        case "mysql":
-                               if (function_exists("mysqli_connect")) {
-                                       $this->adapter = new Db_Mysqli();
-                               } else {
-                                       $this->adapter = new Db_Mysql();
-                               }
+                               $this->adapter = new Db_Mysqli();
                                break;
                        case "pgsql":
                                $this->adapter = new Db_Pgsql();
diff --git a/classes/db/mysql.php b/classes/db/mysql.php
deleted file mode 100644 (file)
index e8701f7..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-class Db_Mysql implements IDb {
-       private $link;
-       private $last_error;
-
-       function connect($host, $user, $pass, $db, $port) {
-               $this->link = mysql_connect($host, $user, $pass);
-
-               if ($this->link) {
-                       $result = mysql_select_db($db, $this->link);
-                       if (!$result) {
-                               die("Can't select DB: " . mysql_error($this->link));
-                       }
-
-                       $this->init();
-
-                       return $this->link;
-               } else {
-                       die("Unable to connect to database (as $user to $host, database $db): " . mysql_error());
-               }
-       }
-
-       function escape_string($s, $strip_tags = true) {
-               if ($strip_tags) $s = strip_tags($s);
-
-               return mysql_real_escape_string($s, $this->link);
-       }
-
-       function query($query, $die_on_error = true) {
-               $result = @mysql_query($query, $this->link);
-               if (!$result) {
-                       $this->last_error = @mysql_error($this->link);
-
-                       @mysql_query("ROLLBACK", $this->link);
-                       user_error("Query $query failed: " . ($this->link ? $this->last_error : "No connection"),
-                               $die_on_error ? E_USER_ERROR : E_USER_WARNING);
-               }
-               return $result;
-       }
-
-       function fetch_assoc($result) {
-               return mysql_fetch_assoc($result);
-       }
-
-
-       function num_rows($result) {
-               return mysql_num_rows($result);
-       }
-
-       function fetch_result($result, $row, $param) {
-               return mysql_result($result, $row, $param);
-       }
-
-       function close() {
-               return mysql_close($this->link);
-       }
-
-       function affected_rows($result) {
-               return mysql_affected_rows($this->link);
-       }
-
-       function last_error() {
-               return mysql_error();
-       }
-
-       function last_query_error() {
-               return $this->last_error;
-       }
-
-       function init() {
-               $this->query("SET time_zone = '+0:0'");
-
-               if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
-                       $this->query("SET NAMES " . MYSQL_CHARSET);
-               }
-
-               return true;
-       }
-
-}
-?>
index 7ca7519c6316e2d1da6a48899ab7dedcd448b6e9..f1181f88c0d69bc7f3a5b3e9c89bd6e8fd512b6b 100755 (executable)
                                array_push($errors, "PHP support for JSON is required, but was not found.");
                        }
 
-                       if (DB_TYPE == "mysql" && !function_exists("mysql_connect") && !function_exists("mysqli_connect")) {
+                       if (DB_TYPE == "mysql" && !function_exists("mysqli_connect")) {
                                array_push($errors, "PHP support for MySQL is required for configured DB_TYPE in config.php.");
                        }
 
index bfbb7e23491e72dad4e92e5508214d96bae5bf28..00e90dfe7c8d8db348cfc35d3de9a3f63e7035b5 100755 (executable)
@@ -51,7 +51,7 @@
                        array_push($errors, "PHP support for JSON is required, but was not found.");
                }
 
-               if ($db_type == "mysql" && !function_exists("mysql_connect") && !function_exists("mysqli_connect")) {
+               if ($db_type == "mysql" && !function_exists("mysqli_connect")) {
                        array_push($errors, "PHP support for MySQL is required for configured $db_type in config.php.");
                }
 
                        return $link;
 
                } else if ($type == "mysql") {
-                       if (function_exists("mysqli_connect")) {
-                               if ($port)
-                                       return mysqli_connect($host, $user, $pass, $db, $port);
-                               else
-                                       return mysqli_connect($host, $user, $pass, $db);
-
-                       } else {
-                               $link = mysql_connect($host, $user, $pass);
-                               if ($link) {
-                                       $result = mysql_select_db($db, $link);
-                                       if ($result) return $link;
-                               }
-                       }
+                       if ($port)
+                               return mysqli_connect($host, $user, $pass, $db, $port);
+                       else
+                               return mysqli_connect($host, $user, $pass, $db);
                }
        }
 
                        return $result;
                } else if ($type == "mysql") {
 
-                       if (function_exists("mysqli_connect")) {
-                               $result = mysqli_query($link, $query);
-                       } else {
-                               $result = mysql_query($query, $link);
-                       }
+                       $result = mysqli_query($link, $query);
+
                        if (!$result) {
                                $query = htmlspecialchars($query);
                                if ($die_on_error) {
-                                       die("Query <i>$query</i> failed: " . ($link ? function_exists("mysqli_connect") ? mysqli_error($link) : mysql_error($link) : "No connection"));
+                                       die("Query <i>$query</i> failed: " . ($link ? mysqli_error($link) : "No connection"));
                                }
                        }
                        return $result;