"- calling setup_header methods via magic __call method, to allow classes to extend this command and alow overwrite the setup_header methods

- added new session-handler config var"
This commit is contained in:
Ralf Becker 2008-08-20 09:01:29 +00:00
parent 93112e0277
commit da43ab71f8

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org * @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de> * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package setup * @package setup
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de> * @copyright (c) 2007/8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$ * @version $Id$
*/ */
@ -55,7 +55,7 @@ class setup_cmd_header extends setup_cmd
} }
/** /**
* test or create database * Create or update header.inc.php
* *
* @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself
* @return string serialized $GLOBALS defined in the header.inc.php * @return string serialized $GLOBALS defined in the header.inc.php
@ -74,7 +74,7 @@ class setup_cmd_header extends setup_cmd
{ {
throw new egw_exception_wrong_userinput(lang('eGroupWare configuration file (header.inc.php) does NOT exist.')."\n".lang('Use --create-header to create the configuration file (--usage gives more options).'),1); throw new egw_exception_wrong_userinput(lang('eGroupWare configuration file (header.inc.php) does NOT exist.')."\n".lang('Use --create-header to create the configuration file (--usage gives more options).'),1);
} }
$this->setup_header->defaults(false); $this->defaults(false);
} }
else else
{ {
@ -105,7 +105,7 @@ class setup_cmd_header extends setup_cmd
{ {
$this->_parse_properties(); $this->_parse_properties();
} }
if (($errors = $this->setup_header->validation_errors($GLOBALS['egw_info']['server']['server_root'], if (($errors = $this->validation_errors($GLOBALS['egw_info']['server']['server_root'],
$GLOBALS['egw_info']['server']['include_root']))) $GLOBALS['egw_info']['server']['include_root'])))
{ {
if ($this->arguments) if ($this->arguments)
@ -120,7 +120,7 @@ class setup_cmd_header extends setup_cmd
{ {
return true; return true;
} }
$header = $this->setup_header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); $header = $this->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']);
if ($this->arguments) if ($this->arguments)
{ {
@ -138,6 +138,21 @@ class setup_cmd_header extends setup_cmd
throw new egw_exception_no_permission(lang("Failed writing configuration file header.inc.php, check the permissions !!!"),24); throw new egw_exception_no_permission(lang("Failed writing configuration file header.inc.php, check the permissions !!!"),24);
} }
/**
* Magic method to allow to call all methods from setup_header, as if they were our own
*
* @param string $method
* @param array $args=null
* @return mixed
*/
protected function __call($method,array $args=null)
{
if (method_exists($this->setup_header,$method))
{
return call_user_func_array(array($this->setup_header,$method),$args);
}
}
/** /**
* Available options and allowed arguments * Available options and allowed arguments
* *
@ -162,6 +177,12 @@ class setup_cmd_header extends setup_cmd
'allowed' => array('php'=>'php4','php4'=>'php4','php-restore'=>'php4-restore','php4-restore'=>'php4-restore','db'=>'db'), 'allowed' => array('php'=>'php4','php4'=>'php4','php-restore'=>'php4-restore','php4-restore'=>'php4-restore','db'=>'db'),
), ),
), ),
'--session-handler' => array(
'session_handler' => array(
'type' => 'egw_info/server/',
'allowed' => array('files'=>'files','memcache'=>'memcache','db'=>'db'),
),
),
'--limit-access' => 'egw_info/server/setup_acl', // name used in setup '--limit-access' => 'egw_info/server/setup_acl', // name used in setup
'--setup-acl' => 'egw_info/server/setup_acl', // alias to match the real name '--setup-acl' => 'egw_info/server/setup_acl', // alias to match the real name
'--mcrypt' => array( '--mcrypt' => array(
@ -295,7 +316,7 @@ class setup_cmd_header extends setup_cmd
$domain = $arg == '--domain' && !$value ? 'default' : $value; $domain = $arg == '--domain' && !$value ? 'default' : $value;
if ($arg == '--domain' && (!isset($GLOBALS['egw_domain'][$domain]) || $this->sub_command == 'create')) if ($arg == '--domain' && (!isset($GLOBALS['egw_domain'][$domain]) || $this->sub_command == 'create'))
{ {
$GLOBALS['egw_domain'][$domain] = $this->setup_header->domain_defaults($GLOBALS['egw_info']['server']['header_admin_user'],$GLOBALS['egw_info']['server']['header_admin_password']); $GLOBALS['egw_domain'][$domain] = $this->domain_defaults($GLOBALS['egw_info']['server']['header_admin_user'],$GLOBALS['egw_info']['server']['header_admin_password']);
} }
} }
elseif ($value !== '') elseif ($value !== '')