allow to set language via setup-cli

This commit is contained in:
Ralf Becker 2008-11-23 16:46:32 +00:00
parent 12d6d29540
commit cddd95b571
4 changed files with 20 additions and 14 deletions

View File

@ -7,15 +7,15 @@
* @package setup
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
* @version $Id$
*/
/**
* setup command: create a first eGroupWare user / admin and our two standard groups: Default & Admins
*
*
* @ToDo: get rid of the ugly setup_admin.php include
*/
class setup_cmd_admin extends setup_cmd
class setup_cmd_admin extends setup_cmd
{
/**
* Constructor
@ -29,9 +29,10 @@ class setup_cmd_admin extends setup_cmd
* @param string $admin_lastname=null
* @param string $admin_email=null
* @param array $config=array() extra config for the account object: account_repository, ldap_*
* @param string $lang='en'
*/
function __construct($domain,$config_user=null,$config_passwd=null,$admin_user=null,$admin_password=null,
$admin_firstname=null,$admin_lastname=null,$admin_email=null,array $config=array())
$admin_firstname=null,$admin_lastname=null,$admin_email=null,array $config=array(),$lang='en')
{
if (!is_array($domain))
{
@ -45,6 +46,7 @@ class setup_cmd_admin extends setup_cmd
'admin_lastname' => $admin_lastname,
'admin_email' => $admin_email,
'config' => $config,
'lang' => $lang,
);
}
//echo __CLASS__.'::__construct()'; _debug_array($domain);
@ -53,7 +55,7 @@ class setup_cmd_admin extends setup_cmd
/**
* run the command: create eGW admin and standard groups
*
*
* @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself
* @return string success message
* @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2);
@ -75,7 +77,8 @@ class setup_cmd_admin extends setup_cmd
$_POST['fname'] = $this->admin_firstname;
$_POST['lname'] = $this->admin_lastname;
$_POST['email'] = $this->admin_email;
$_POST['ConfigLang'] = $this->lang;
$_POST['submit'] = true;
$error = include(dirname(__FILE__).'/../admin_account.php');

View File

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

View File

@ -25,8 +25,9 @@ class setup_cmd_install extends setup_cmd
* @param string $charset='utf-8' charset for the install, default utf-8 now
* @param boolean $verbose=false if true, echos out some status information during the run
* @param array $config=array() configuration to preset the defaults during the install, eg. set the account_repository
* @param string $lang='en'
*/
function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$charset='utf-8',$verbose=false,$config=array())
function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$charset='utf-8',$verbose=false,array $config=array(),$lang='en')
{
if (!is_array($domain))
{
@ -38,6 +39,7 @@ class setup_cmd_install extends setup_cmd
'charset' => $charset,
'verbose' => $verbose,
'config' => $config,
'lang' => $lang,
);
}
elseif(!$domain['charset'])
@ -101,6 +103,7 @@ class setup_cmd_install extends setup_cmd
// 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);
$_POST['ConfigLang'] = $this->lang;
if ($this->verbose) echo lang('Installation started, this might take a few minutes ...')."\n";
$setup_info = self::$egw_setup->process->pass($setup_info,'new',false,True,$this->config);

View File

@ -186,14 +186,14 @@ function do_emailadmin()
/**
* Create an admin account
*
* @param string $arg domain(default),[config user(admin)],password,username,password,[first name],[last name],[email]
* @param string $arg domain(default),[config user(admin)],password,username,password,[first name],[last name],[email],[lang]
*/
function do_admin($arg)
{
list($domain,$user,$password,$admin,$pw,$first,$last,$email) = explode(',',$arg);
list($domain,$user,$password,$admin,$pw,$first,$last,$email,$lang) = explode(',',$arg);
_fetch_user_password($user,$password);
$cmd = new setup_cmd_admin($domain,$user,$password,$admin,$pw,$first,$last,$email);
$cmd = new setup_cmd_admin($domain,$user,$password,$admin,$pw,$first,$last,$email,array(),$lang);
echo $cmd->run()."\n";
}
@ -372,14 +372,14 @@ function _check_auth_config($arg,$stop,$set_lang=true)
/**
* Install eGroupWare
*
* @param string $args domain,[config user(admin)],password,[backup-file],[charset]
* @param string $args domain,[config user(admin)],password,[backup-file],[charset],[lang]
*/
function do_install($args)
{
list($domain,$user,$password,$backup,$charset) = explode(',',$args);
list($domain,$user,$password,$backup,$charset,$lang) = explode(',',$args);
_fetch_user_password($user,$password);
$cmd = new setup_cmd_install($domain,$user,$password,$backup,$charset,true);
$cmd = new setup_cmd_install($domain,$user,$password,$backup,$charset,true,array(),$lang);
echo $cmd->run()."\n";
}