From: Hypolite Petovan Date: Wed, 5 Oct 2016 03:43:44 +0000 (-0400) Subject: Fix Issue #2816 - Add backward compatible server_info support X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c1611fd3f6b572f17eec04c113272a76667fdad7;p=friendica.git Fix Issue #2816 - Add backward compatible server_info support --- diff --git a/include/dba.php b/include/dba.php index 97f6c87956..9ccdcd1304 100644 --- a/include/dba.php +++ b/include/dba.php @@ -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; diff --git a/include/dbstructure.php b/include/dbstructure.php index 9e0020fdbe..d3b148b2a8 100644 --- a/include/dbstructure.php +++ b/include/dbstructure.php @@ -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';