fix not working installation under PHP 8.1 due to mysqli throwing errors now by default

This commit is contained in:
ralf 2022-05-20 18:00:41 +02:00
parent 3dd247f1df
commit c57ae62d1c
7 changed files with 27 additions and 27 deletions

View File

@ -125,7 +125,7 @@ class Categories
if (!$app_name) $app_name = $GLOBALS['egw_info']['flags']['currentapp'];
if ($accountid === self::GLOBAL_ACCOUNT ||
$accountid < 0 && $GLOBALS['egw']->accounts->exists($accountid) == 2)
(int)$accountid < 0 && $GLOBALS['egw']->accounts->exists($accountid) == 2)
{
$this->account_id = (int) $accountid;
}

View File

@ -358,7 +358,7 @@ class Db
//error_log(__METHOD__."() this->Host(s)=$this->Host, n=$n --> host=$host");
$new_connection = !$this->Link_ID || !$this->Link_ID->IsConnected();
$this->_connect($host);
// check if connected node is healty
// check if connected node is healthy
if ($new_connection && self::$health_check)
{
call_user_func(self::$health_check, $this);

View File

@ -31,6 +31,6 @@ class Exception extends \Exception
// nothing fancy yet
function __construct($msg=null,$code=100,\Exception $previous=null)
{
return parent::__construct($msg, $code, $previous);
parent::__construct($msg, $code, $previous);
}
}

View File

@ -354,7 +354,7 @@ class Translation
$loaded =& self::load_app_files($app, $l, null, $updated_load_via);
}
//error_log(__METHOD__."('$app', '$lang') instance_specific=$instance_specific, load_app(_files)() returned ".(is_array($loaded)?'Array('.count($loaded).')':array2string($loaded)));
if ($loaded || $instance_specific)
if ($loaded)
{
Cache::setCache($instance_specific ? Cache::INSTANCE : Cache::TREE,
__CLASS__, $app.':'.$l, $loaded);
@ -401,6 +401,7 @@ class Translation
if (!isset(self::$db)) return;
}
$loaded = array();
try {
foreach (self::$db->select(self::LANG_TABLE, 'message_id,content', array(
'lang' => $lang,
'app_name' => $app,
@ -408,6 +409,10 @@ class Translation
{
$loaded[strtolower($row['message_id'])] = $row['content'];
}
}
catch (Db\Exception $e) {
// ignore error
}
//error_log(__METHOD__."($app,$lang) took ".(1000*(microtime(true)-$start))." ms to load ".count($loaded)." phrases");
return $loaded;
}

View File

@ -55,7 +55,7 @@ class setup
*/
var $html;
var $system_charset;
var $system_charset = 'utf-8';
var $lang;
var $ConfigDomain;
@ -90,8 +90,6 @@ class setup
$this->detection = new setup_detection();
$this->process = new setup_process();
if (preg_match('/^[a-z0-9-]+$/i', $_REQUEST['system_charset'])) $this->system_charset = $_REQUEST['system_charset'];
/* The setup application needs these */
if ($html) $this->html = new setup_html();
if ($translation) $this->translation = new setup_translation();
@ -137,7 +135,7 @@ class setup
$this->db_charset_was = $this->db->Link_ID->GetCharSet(); // needed for the update
// we can NOT set the DB charset for mysql, if the api version < 1.0.1.019, as it would mess up the DB content!!!
if (substr($this->db->Type,0,5) == 'mysql') // we need to check the api version
if (substr($this->db->Type,0,5) === 'mysql') // we need to check the api version
{
$api_version = $this->db->select($this->applications_table,'app_version',array(
'app_name' => 'phpgwapi',

View File

@ -300,7 +300,8 @@ class setup_detection
if (!$setup_info) $setup_info = $GLOBALS['setup_info'];
try { // catch DB errors
if (!$GLOBALS['egw_setup']->db->Link_ID)
if (empty($GLOBALS['egw_setup']->db->Link_ID) ||
empty($GLOBALS['egw_setup']->db->Link_ID->_connectionID))
{
$old = error_reporting();
error_reporting($old & ~E_WARNING); // no warnings
@ -310,11 +311,13 @@ class setup_detection
$GLOBALS['egw_setup']->set_table_names();
}
}
catch(Api\Db\Exception $e) {
catch(\Exception $e) {
// ignore error
}
if (!$GLOBALS['egw_setup']->db->Link_ID || !$GLOBALS['egw_setup']->db->Link_ID->_connectionID)
if (empty($GLOBALS['egw_setup']->db->Link_ID) ||
empty($GLOBALS['egw_setup']->db->Link_ID->_connectionID) ||
$GLOBALS['egw_setup']->db->Link_ID->_connectionID->connect_errno)
{
$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage 1 (Create Database)';
return 1;

View File

@ -342,12 +342,6 @@ switch($GLOBALS['egw_info']['setup']['stage']['db'])
else
{
$s_info = $GLOBALS['egw_setup']->detection->upgrade_exclude($setup_info);
// Set the DB's client charset if a system-charset is set
if (preg_match('/^[a-z0-9-]+$/i', $_REQUEST['system_charset']))
{
$GLOBALS['egw_setup']->system_charset = $_REQUEST['system_charset'];
$GLOBALS['egw_setup']->db->Link_ID->SetCharSet($_REQUEST['system_charset']);
}
$setup_info = $GLOBALS['egw_setup']->process->pass($s_info,'new',$_REQUEST['debug'],True);
$GLOBALS['egw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
}