- setting set_defaults also with values containing (now replaced) replacements like $domain

- shorten db-name/-user to self::MAX_DB_NAME_LEN chars
This commit is contained in:
Ralf Becker 2010-08-25 12:24:11 +00:00
parent 316ac13e31
commit 6c885b31fb
3 changed files with 10 additions and 3 deletions

View File

@ -387,7 +387,7 @@ class setup_cmd_config extends setup_cmd
} }
if (strpos($this->$name,'$') !== false) if (strpos($this->$name,'$') !== false)
{ {
$this->$name = str_replace(array( $this->set_defaults[$name] = $this->$name = str_replace(array(
'$domain', '$domain',
),array( ),array(
$this->domain, $this->domain,

View File

@ -174,6 +174,13 @@ class setup_cmd_database extends setup_cmd
{ {
static $try_make_unique = 0; // to limit trials to create a unique name static $try_make_unique = 0; // to limit trials to create a unique name
// shorten db-name/-user to self::MAX_DB_NAME_LEN chars
if ($this->make_db_name_unique && strlen($this->db_name) > self::MAX_DB_NAME_LEN)
{
$this->set_defaults['db_name'] = $this->db_name =
$this->set_defaults['db_user'] = $this->db_user = // change user too (otherwise existing user/db could not connect any more!)
substr($this->db_name,0,self::MAX_DB_NAME_LEN);
}
try { try {
$msg = $this->connect(); $msg = $this->connect();
} }
@ -206,7 +213,7 @@ class setup_cmd_database extends setup_cmd
$this->set_defaults['db_user'] = $this->db_user = // change user too (otherwise existing user/db could not connect any more!) $this->set_defaults['db_user'] = $this->db_user = // change user too (otherwise existing user/db could not connect any more!)
substr($this->db_name,0,self::MAX_DB_NAME_LEN-strlen($num)).$num; substr($this->db_name,0,self::MAX_DB_NAME_LEN-strlen($num)).$num;
return $this->create(); return $this->create();
} }
catch (egw_exception_wrong_userinput $e2) catch (egw_exception_wrong_userinput $e2)
{ {

View File

@ -343,7 +343,7 @@ class setup_cmd_ldap extends setup_cmd
} }
if (strpos($this->$name,'$') !== false) if (strpos($this->$name,'$') !== false)
{ {
$this->$name = str_replace(array( $this->set_defaults[$name] = $this->$name = str_replace(array(
'$domain', '$domain',
'$suffix', '$suffix',
'$base', '$base',