fix installation under PHP 8.1

This commit is contained in:
ralf 2022-12-05 15:55:30 +01:00
parent ad261f57c9
commit f61ce9eae8
5 changed files with 59 additions and 46 deletions

View File

@ -160,7 +160,7 @@ abstract class admin_cmd
* *
* @return string * @return string
*/ */
function __tostring() function __toString()
{ {
return $this->type; return $this->type;
} }
@ -274,7 +274,7 @@ abstract class admin_cmd
* of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash * of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash
* of the md5 hash of the config password and the install_id (egw_admin_remote.remote_hash) * of the md5 hash of the config password and the install_id (egw_admin_remote.remote_hash)
* *
* @return string sussess message * @return string success message
* @throws Exception(lang('Invalid remote id or name "%1"!',$this->remote_id),997) or other Exceptions reported from remote * @throws Exception(lang('Invalid remote id or name "%1"!',$this->remote_id),997) or other Exceptions reported from remote
*/ */
protected function remote_exec() protected function remote_exec()
@ -380,6 +380,8 @@ abstract class admin_cmd
$vars['type'] = substr($this->type, 11); $vars['type'] = substr($this->type, 11);
} }
try
{
admin_cmd::$sql->init($vars); admin_cmd::$sql->init($vars);
if (admin_cmd::$sql->save() != 0) if (admin_cmd::$sql->save() != 0)
{ {
@ -400,16 +402,21 @@ abstract class admin_cmd
{ {
admin_cmd::_set_async_job(); admin_cmd::_set_async_job();
} }
// schedule periodic execution, if we have an rrule // schedule periodic execution, if we have a rrule
elseif (!empty($this->rrule) && $this->status != admin_cmd::deleted) elseif (!empty($this->rrule) && $this->status != admin_cmd::deleted)
{ {
$this->set_periodic_job(); $this->set_periodic_job();
} }
// existing object with no rrule, cancle evtl. running periodic job // existing object with no rrule, cancel evtl. running periodic job
elseif ($vars['id']) elseif ($vars['id'])
{ {
$this->cancel_periodic_job(); $this->cancel_periodic_job();
} }
}
catch (Api\Db\Exception $e) {
_egw_log_exception($e);
return false;
}
return true; return true;
} }
@ -461,7 +468,7 @@ abstract class admin_cmd
} }
/** /**
* Instanciated the object / subclass using the given data * Instantiate the object / subclass using the given data
* *
* @static * @static
* @param array $data * @param array $data

View File

@ -69,7 +69,7 @@ use HTTP_WebDAV_Server;
*/ */
class Vfs extends Vfs\Base class Vfs extends Vfs\Base
{ {
const PREFIX = Vfs\StreamWrapper::PREFIX; const PREFIX = 'vfs://default'; // using the original definition sometimes gives an autoloading error: Vfs\StreamWrapper::PREFIX;
/** /**
* Name of the lock table * Name of the lock table

View File

@ -313,7 +313,7 @@ class setup_cmd_header extends setup_cmd
* *
* @param string $arg current cli argument processed * @param string $arg current cli argument processed
* @param string $name name of the property * @param string $name name of the property
* @param array/string $data string with type or array containing values for type, allowed * @param array|string $data string with type or array containing values for type, allowed
* @param mixed $value value to set * @param mixed $value value to set
*/ */
private function _parse_value($arg,$name,$data,$value) private function _parse_value($arg,$name,$data,$value)
@ -321,7 +321,7 @@ class setup_cmd_header extends setup_cmd
static $domain=null; static $domain=null;
if (!is_array($data)) $data = array('type' => $data); if (!is_array($data)) $data = array('type' => $data);
$type = $data['type']; $type = $data['type'] ?? '';
if (isset($data['allowed'])) if (isset($data['allowed']))
{ {
@ -341,31 +341,37 @@ class setup_cmd_header extends setup_cmd
} }
elseif ($value !== '') elseif ($value !== '')
{ {
self::_set_value($GLOBALS,str_replace('@',$domain,$type),$name,$value); self::_set_global(str_replace('@', $domain, $type), $name, $value);
if ($type == 'egw_info/server/server_root') if ($type == 'egw_info/server/server_root')
{ {
self::_set_value($GLOBALS,'egw_info/server/include_root',$name,$value); self::_set_global('egw_info/server/include_root', $name, $value);
} }
} }
} }
/** /**
* Set a value in the given array $arr with (multidimensional) key $index[/$name] * Set a value in $GLOBALS with (multidimensional) key $index[/$name]
* *
* @param array &$arr
* @param string $index multidimensional index written with / as separator, eg. egw_info/server/ * @param string $index multidimensional index written with / as separator, eg. egw_info/server/
* @param string $name additional index to use if $index end with a slash * @param string $name additional index to use if $index end with a slash
* @param mixed $value value to set * @param mixed $value value to set
*/ */
static private function _set_value(&$arr,$index,$name,$value) private static function _set_global($index, $name, $value)
{ {
if (substr($index,-1) == '/') $index .= $name; if (substr($index,-1) == '/') $index .= $name;
$var =& $arr; $var = null;
foreach(explode('/',$index) as $name) foreach(explode('/',$index) as $n)
{ {
$var =& $var[$name]; if (isset($var))
{
$var =& $var[$n];
} }
if (true) $var = $value; else
{
$var =& $GLOBALS[$n];
}
}
$var = $value;
} }
} }

View File

@ -109,8 +109,8 @@ class setup_cmd_install extends setup_cmd
$setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info);
// Set the DB's client charset if a system-charset is set // Set the DB's client charset if a system-charset is set
self::$egw_setup->system_charset = strtolower($this->charset); self::$egw_setup->system_charset = 'utf-8';
self::$egw_setup->db->Link_ID->SetCharSet($this->charset); self::$egw_setup->db->Link_ID->SetCharSet(self::$egw_setup->db->Type === 'mysql' ? 'utf8' : 'utf-8');
$_POST['ConfigLang'] = $this->lang; $_POST['ConfigLang'] = $this->lang;
if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n"; if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n";

View File

@ -30,7 +30,7 @@ if(file_exists(__DIR__.'/../../header.inc.php'))
include_once(__DIR__.'/../../header.inc.php'); include_once(__DIR__.'/../../header.inc.php');
} }
// for an old header we need to setup a reference for the domains // for an old header we need to setup a reference for the domains
if (!is_array($GLOBALS['egw_domain'])) $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain']; if (!isset($GLOBALS['egw_domain']) && isset($GLOBALS['phpgw_domain'])) $GLOBALS['egw_domain'] =& $GLOBALS['phpgw_domain'];
/* If we included the header.inc.php, but it is somehow broken, cover ourselves... */ /* If we included the header.inc.php, but it is somehow broken, cover ourselves... */
if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) if(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT'))