Commit 0b6c0554 authored by Marius Burkard's avatar Marius Burkard
Browse files

- set mysqli reporting to OFF as it was prior to PHP 8.1

parent 7c33625f
Pipeline #11112 passed with stage
in 7 minutes and 23 seconds
......@@ -249,7 +249,7 @@ class installer_base {
$msg = '';
if(version_compare(phpversion(), '5.4', '<')) $msg .= "PHP Version 5.4 or newer is required. The currently used PHP version is ".phpversion().".\n";
if(version_compare(phpversion(), '8.0', '>=')) $msg .= "PHP Version 8 is not supported yet. Change PHP version back to the default version of the OS. The currently used PHP version is ".phpversion().".\n";
if(version_compare(phpversion(), '8.2', '>=')) $msg .= "PHP Version 8.2+ is not supported yet. Change PHP version back to the default version of the OS. The currently used PHP version is ".phpversion().".\n";
if(!function_exists('curl_init')) $msg .= "PHP Curl Module is missing.\n";
if(!function_exists('mysqli_connect')) $msg .= "PHP MySQLi Module is nmissing.\n";
if(!function_exists('mb_detect_encoding')) $msg .= "PHP Multibyte Module (MB) is missing.\n";
......
......@@ -64,9 +64,11 @@ class db
public function __destruct() {
if($this->_iConnId) mysqli_close($this->_iConnId);
}
private function do_connect() {
global $conf;
mysqli_report(MYSQLI_REPORT_OFF);
if($this->_iConnId) return true;
$this->dbHost = $conf['mysql']['host'];
......@@ -77,7 +79,7 @@ class db
$this->dbCharset = $conf["mysql"]["charset"];
$this->dbNewLink = false;
$this->dbClientFlags = null;
$this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort);
$try = 0;
while((!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5) {
......@@ -92,19 +94,19 @@ class db
$this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!');
return false;
}
if($this->dbName) $this->setDBName($this->dbName);
$this->_setCharset();
}
public function setDBData($host, $user, $password, $port) {
$this->dbHost = $host;
$this->dbUser = $user;
$this->dbPass = $password;
$this->dbPort = $port;
}
public function setDBName($name) {
$this->dbName = $name;
$this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort);
......@@ -114,7 +116,7 @@ class db
return false;
}
}
public function close() {
if($this->_iConnId) mysqli_close($this->_iConnId);
$this->_iConnId = null;
......@@ -192,7 +194,7 @@ class db
}
private function _query($sQuery = '') {
$aArgs = func_get_args();
$this->do_connect();
......@@ -284,7 +286,7 @@ class db
* @return array result row or NULL if none found
*/
public function queryOneRecord($sQuery = '') {
$aArgs = func_get_args();
if(!empty($aArgs)) {
$sQuery = array_shift($aArgs);
......@@ -293,7 +295,7 @@ class db
}
array_unshift($aArgs, $sQuery);
}
$oResult = call_user_func_array([&$this, 'query'], $aArgs);
if(!$oResult) return null;
......@@ -534,7 +536,7 @@ class db
if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
}
}
/* TODO: rewrite SQL */
function update($tablename, $form, $bedingung, $debug = 0)
{
......@@ -761,14 +763,14 @@ class db
break;
}
}
/**
* Get the database type (mariadb or mysql)
*
* @access public
* @return string 'mariadb' or string 'mysql'
*/
public function getDatabaseType() {
$tmp = $this->queryOneRecord('SELECT VERSION() as version');
if(stristr($tmp['version'],'mariadb')) {
......@@ -777,7 +779,7 @@ class db
return 'mysql';
}
}
/**
* Get the database version
*
......@@ -785,7 +787,7 @@ class db
* @param bool $major_version_only = true will return the major version only, e.g. 8 for MySQL 8
* @return string version number
*/
public function getDatabaseVersion($major_version_only = false) {
$tmp = $this->queryOneRecord('SELECT VERSION() as version');
$version = explode('-', $tmp['version']);
......
......@@ -82,6 +82,8 @@ class db
$this->dbClientFlags = ($flags !== NULL) ? $flags : $conf['db_client_flags'];
$this->_iConnId = mysqli_init();
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags);
for($try=0;(!is_object($this->_iConnId) || mysqli_connect_errno()) && $try < 5;++$try) {
sleep($try);
......
......@@ -82,6 +82,8 @@ class db
$this->dbClientFlags = ($flags !== NULL) ? $flags : $conf['db_client_flags'];
$this->_iConnId = mysqli_init();
mysqli_report(MYSQLI_REPORT_OFF);
mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags);
for($try=0;(!is_object($this->_iConnId) || mysqli_connect_errno()) && $try < 5;++$try) {
sleep($try);
......
......@@ -166,9 +166,9 @@ class mysql_clientdb_plugin {
$link->escape_string($database_password));
if(!$link->query($query)) $success = false;
}
$app->log("PASSWORD SET FOR '".$link->escape_string($database_user)."'@'$db_host' success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
if($success == true){
$link->query("FLUSH PRIVILEGES");
}
......@@ -261,6 +261,7 @@ class mysql_clientdb_plugin {
return;
}
mysqli_report(MYSQLI_REPORT_OFF);
//* Connect to the database
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
if ($link->connect_error) {
......@@ -324,6 +325,7 @@ class mysql_clientdb_plugin {
return;
}
mysqli_report(MYSQLI_REPORT_OFF);
//* Connect to the database
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
if ($link->connect_error) {
......@@ -654,6 +656,7 @@ class mysql_clientdb_plugin {
return;
}
mysqli_report(MYSQLI_REPORT_OFF);
//* Connect to the database
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
if ($link->connect_error) {
......@@ -709,6 +712,7 @@ class mysql_clientdb_plugin {
return;
}
mysqli_report(MYSQLI_REPORT_OFF);
//* Connect to the database
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
if ($link->connect_error) {
......@@ -782,6 +786,7 @@ class mysql_clientdb_plugin {
return;
}
mysqli_report(MYSQLI_REPORT_OFF);
//* Connect to the database
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
if ($link->connect_error) {
......@@ -807,16 +812,16 @@ class mysql_clientdb_plugin {
$link->close();
}
function getDatabaseType($link) {
$result = $link->query('SELECT VERSION() as version');
if($result) {
$tmp = $result->fetch_assoc();
$result->free();
if(stristr($tmp['version'],'mariadb')) {
return 'mariadb';
} else {
......@@ -832,7 +837,7 @@ class mysql_clientdb_plugin {
if($result) {
$tmp = $result->fetch_assoc();
$result->free();
$version = explode('-', $tmp['version']);
if($major_version_only == true) {
$version_parts = explode('.', $version[0]);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment