]> git.mxchange.org Git - friendica.git/commitdiff
Fix Issue #2816 - Add backward compatible server_info support
authorHypolite Petovan <ben.lort@gmail.com>
Wed, 5 Oct 2016 03:43:44 +0000 (23:43 -0400)
committerHypolite Petovan <ben.lort@gmail.com>
Wed, 5 Oct 2016 03:43:44 +0000 (23:43 -0400)
include/dba.php
include/dbstructure.php

index 97f6c8795645492aeda5f47cd5707dc0b325545a..9ccdcd130413862d327d1ace1ff65ac51961a227 100644 (file)
@@ -91,6 +91,22 @@ class dba {
                return $this->db;
        }
 
+       /** Returns the MySQL server version string
+        *
+        * This function discriminate between the deprecated mysql API and the current
+        * object-oriented mysqli API. Example of returned string: 5.5.46-0+deb8u1
+        *
+        * @return string
+        */
+       public function server_info() {
+               if ($this->mysqli) {
+                       $return = $this->db->server_info;
+               } else {
+                       $return = mysql_get_server_info($this->db);
+               }
+               return $return;
+       }
+
        public function q($sql, $onlyquery = false) {
                global $a;
 
index 9e0020fdbe21f5d0bb94780263ae99c30a3bb691..d3b148b2a8bfbf6b4e3dc83dbe4c7cc5e4e73bd2 100644 (file)
@@ -166,7 +166,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
                @$db->q($sql_config);
 
        // MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
-       if (version_compare($db->getdb()->server_info, '5.7.4') >= 0) {
+       if (version_compare($db->server_info(), '5.7.4') >= 0) {
                $ignore = '';
        }else {
                $ignore = ' IGNORE';