diff --git a/admin/inc/class.admin_cmd.inc.php b/admin/inc/class.admin_cmd.inc.php index a1b4a1fc00..aeaaa5fab0 100644 --- a/admin/inc/class.admin_cmd.inc.php +++ b/admin/inc/class.admin_cmd.inc.php @@ -160,7 +160,7 @@ abstract class admin_cmd * * @return string */ - function __tostring() + function __toString() { 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 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 */ protected function remote_exec() @@ -380,35 +380,42 @@ abstract class admin_cmd $vars['type'] = substr($this->type, 11); } - admin_cmd::$sql->init($vars); - if (admin_cmd::$sql->save() != 0) + try { - return false; - } - if (!$this->id) - { - $this->id = admin_cmd::$sql->data['id']; - // if the cmd has no uid yet, we create one from our id and the install-id of this eGW instance - if (!$this->uid) + admin_cmd::$sql->init($vars); + if (admin_cmd::$sql->save() != 0) { - $this->uid = $this->id.'-'.$GLOBALS['egw_info']['server']['install_id']; - admin_cmd::$sql->save(array('uid' => $this->uid)); + return false; + } + if (!$this->id) + { + $this->id = admin_cmd::$sql->data['id']; + // if the cmd has no uid yet, we create one from our id and the install-id of this eGW instance + if (!$this->uid) + { + $this->uid = $this->id . '-' . $GLOBALS['egw_info']['server']['install_id']; + admin_cmd::$sql->save(array('uid' => $this->uid)); + } + } + // install an async job, if we saved a scheduled job + if ($this->status == admin_cmd::scheduled && empty($this->rrule)) + { + admin_cmd::_set_async_job(); + } + // schedule periodic execution, if we have a rrule + elseif (!empty($this->rrule) && $this->status != admin_cmd::deleted) + { + $this->set_periodic_job(); + } + // existing object with no rrule, cancel evtl. running periodic job + elseif ($vars['id']) + { + $this->cancel_periodic_job(); } } - // install an async job, if we saved a scheduled job - if ($this->status == admin_cmd::scheduled && empty($this->rrule)) - { - admin_cmd::_set_async_job(); - } - // schedule periodic execution, if we have an rrule - elseif (!empty($this->rrule) && $this->status != admin_cmd::deleted) - { - $this->set_periodic_job(); - } - // existing object with no rrule, cancle evtl. running periodic job - elseif($vars['id']) - { - $this->cancel_periodic_job(); + catch (Api\Db\Exception $e) { + _egw_log_exception($e); + return false; } 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 * @param array $data diff --git a/api/src/Vfs.php b/api/src/Vfs.php index 86cf7e145f..767bdfe3c8 100644 --- a/api/src/Vfs.php +++ b/api/src/Vfs.php @@ -69,7 +69,7 @@ use HTTP_WebDAV_Server; */ 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 diff --git a/setup/inc/class.setup_cmd_header.inc.php b/setup/inc/class.setup_cmd_header.inc.php index 6d8015f5d4..67e430004d 100644 --- a/setup/inc/class.setup_cmd_header.inc.php +++ b/setup/inc/class.setup_cmd_header.inc.php @@ -313,7 +313,7 @@ class setup_cmd_header extends setup_cmd * * @param string $arg current cli argument processed * @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 */ private function _parse_value($arg,$name,$data,$value) @@ -321,7 +321,7 @@ class setup_cmd_header extends setup_cmd static $domain=null; if (!is_array($data)) $data = array('type' => $data); - $type = $data['type']; + $type = $data['type'] ?? ''; if (isset($data['allowed'])) { @@ -341,31 +341,37 @@ class setup_cmd_header extends setup_cmd } 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') { - 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 $name additional index to use if $index end with a slash * @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; - $var =& $arr; - foreach(explode('/',$index) as $name) + $var = null; + foreach(explode('/',$index) as $n) { - $var =& $var[$name]; + if (isset($var)) + { + $var =& $var[$n]; + } + else + { + $var =& $GLOBALS[$n]; + } } - if (true) $var = $value; + $var = $value; } -} +} \ No newline at end of file diff --git a/setup/inc/class.setup_cmd_install.inc.php b/setup/inc/class.setup_cmd_install.inc.php index f61c54b1f8..3392726319 100644 --- a/setup/inc/class.setup_cmd_install.inc.php +++ b/setup/inc/class.setup_cmd_install.inc.php @@ -109,8 +109,8 @@ class setup_cmd_install extends setup_cmd $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); // Set the DB's client charset if a system-charset is set - self::$egw_setup->system_charset = strtolower($this->charset); - self::$egw_setup->db->Link_ID->SetCharSet($this->charset); + self::$egw_setup->system_charset = 'utf-8'; + self::$egw_setup->db->Link_ID->SetCharSet(self::$egw_setup->db->Type === 'mysql' ? 'utf8' : 'utf-8'); $_POST['ConfigLang'] = $this->lang; if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n"; @@ -120,4 +120,4 @@ class setup_cmd_install extends setup_cmd return lang('Installation finished'); } -} +} \ No newline at end of file diff --git a/setup/inc/functions.inc.php b/setup/inc/functions.inc.php index 9e8d69c45f..0a5f1a16f3 100644 --- a/setup/inc/functions.inc.php +++ b/setup/inc/functions.inc.php @@ -30,7 +30,7 @@ if(file_exists(__DIR__.'/../../header.inc.php')) include_once(__DIR__.'/../../header.inc.php'); } // 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(!defined('EGW_SERVER_ROOT') && !defined('EGW_INCLUDE_ROOT')) @@ -88,4 +88,4 @@ if (!function_exists('version_compare') || version_compare(PHP_VERSION,$GLOBALS[ echo "EGroupware now requires PHP {$GLOBALS['egw_setup']->required_php_version} or greater.\nYour PHP version is: ".PHP_VERSION."\n"; echo 'Please contact your System Administrator.'; exit; -} +} \ No newline at end of file