]> git.mxchange.org Git - friendica.git/commitdiff
No obsolete mysql_* anymore
authorMichael <heluecht@pirati.ca>
Tue, 21 Nov 2017 21:00:11 +0000 (21:00 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 21 Nov 2017 21:00:11 +0000 (21:00 +0000)
include/dba.php
include/uimport.php

index 070722b9baaef8cecc4566a2cf25c2e2bd81735b..79c15c85bdc599292c361a3932e89bfbadb020d9 100644 (file)
@@ -93,18 +93,6 @@ class dba {
                        }
                }
 
-               if (!self::$connected && function_exists('mysql_connect')) {
-                       self::$driver = 'mysql';
-                       self::$db = mysql_connect($serveraddr, $user, $pass);
-                       if (self::$db && mysql_select_db($db, self::$db)) {
-                               self::$connected = true;
-
-                               if (isset($a->config["system"]["db_charset"])) {
-                                       mysql_set_charset($a->config["system"]["db_charset"], self::$db);
-                               }
-                       }
-               }
-
                // No suitable SQL driver was found.
                if (!self::$connected) {
                        self::$db = null;
@@ -134,9 +122,6 @@ class dba {
                                case 'mysqli':
                                        self::$_server_info = self::$db->server_info;
                                        break;
-                               case 'mysql':
-                                       self::$_server_info = mysql_get_server_info(self::$db);
-                                       break;
                        }
                }
                return self::$_server_info;
@@ -216,8 +201,6 @@ class dba {
                                return substr(@self::$db->quote($str, PDO::PARAM_STR), 1, -1);
                        case 'mysqli':
                                return @self::$db->real_escape_string($str);
-                       case 'mysql':
-                               return @mysql_real_escape_string($str,self::$db);
                }
        }
 
@@ -235,9 +218,6 @@ class dba {
                        case 'mysqli':
                                $connected = self::$db->ping();
                                break;
-                       case 'mysql':
-                               $connected = mysql_ping(self::$db);
-                               break;
                }
                return $connected;
        }
@@ -485,22 +465,6 @@ class dba {
                                        self::$affected_rows = $retval->affected_rows;
                                }
                                break;
-                       case 'mysql':
-                               // For the old "mysql" functions we cannot use prepared statements
-                               $retval = mysql_query(self::replace_parameters($sql, $args), self::$db);
-                               if (mysql_errno(self::$db)) {
-                                       self::$error = mysql_error(self::$db);
-                                       self::$errorno = mysql_errno(self::$db);
-                               } else {
-                                       self::$affected_rows = mysql_affected_rows($retval);
-
-                                       // Due to missing mysql_* support this here wasn't tested at all
-                                       // See here: http://php.net/manual/en/function.mysql-num-rows.php
-                                       if (self::$affected_rows <= 0) {
-                                               self::$affected_rows = mysql_num_rows($retval);
-                                       }
-                               }
-                               break;
                }
 
                // We are having an own error logging in the function "e"
@@ -668,8 +632,6 @@ class dba {
                                return $stmt->columnCount();
                        case 'mysqli':
                                return $stmt->field_count;
-                       case 'mysql':
-                               return mysql_affected_rows($stmt);
                }
                return 0;
        }
@@ -688,8 +650,6 @@ class dba {
                                return $stmt->rowCount();
                        case 'mysqli':
                                return $stmt->num_rows;
-                       case 'mysql':
-                               return mysql_num_rows($stmt);
                }
                return 0;
        }
@@ -740,8 +700,6 @@ class dba {
                                        $columns[$fields[$param]->name] = $col;
                                }
                                return $columns;
-                       case 'mysql':
-                               return mysql_fetch_array($stmt, MYSQL_ASSOC);
                }
        }
 
@@ -781,9 +739,6 @@ class dba {
                        case 'mysqli':
                                $id = self::$db->insert_id;
                                break;
-                       case 'mysql':
-                               $id = mysql_insert_id(self::$db);
-                               break;
                }
                return $id;
        }
@@ -1250,10 +1205,8 @@ class dba {
                        case 'pdo':
                                return $stmt->closeCursor();
                        case 'mysqli':
-                               return $stmt->free_result();
+                               $stmt->free_result();
                                return $stmt->close();
-                       case 'mysql':
-                               return mysql_free_result($stmt);
                }
        }
 }
index 93f978c0778a31c0bba201e93f179a6a303d22f0..8554ba6f0bf67dc6b43e38294e168d77f5259bfb 100644 (file)
@@ -147,7 +147,6 @@ function import_account(App $a, $file) {
        // import user
        $r = db_import_assoc('user', $account['user']);
        if ($r === false) {
-               //echo "<pre>"; var_dump($r, $query, mysql_error()); killme();
                logger("uimport:insert user : ERROR : " . dba::errorMessage(), LOGGER_NORMAL);
                notice(t("User creation error"));
                return;