- using EGW_*_ROOT instead of .., to allow running from different directories

- allow running setup_cmd_admin directly via the command line with regular syntax (was already possible under special syntax)
- limiting database names to 16 chars, which is the limit in mysql
This commit is contained in:
Ralf Becker 2010-07-26 08:20:14 +00:00
parent f8a2efe8df
commit 58993cfb7b
5 changed files with 11 additions and 5 deletions

View File

@ -231,7 +231,7 @@ abstract class setup_cmd extends admin_cmd
if (!$versions['phpgwapi'])
{
if (!include('../phpgwapi/setup/setup.inc.php'))
if (!include(EGW_INCLUDE_ROOT.'/phpgwapi/setup/setup.inc.php'))
{
throw new egw_exception_wrong_userinput(lang("eGroupWare sources in '%1' are not complete, file '%2' missing !!!",realpath('..'),'phpgwapi/setup/setup.inc.php'),99); // should not happen ;-)
}

View File

@ -17,6 +17,11 @@
*/
class setup_cmd_admin extends setup_cmd
{
/**
* Allow to run this command via setup-cli
*/
const SETUP_CLI_CALLABLE = true;
/**
* Constructor
*

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package setup
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2007-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
@ -262,7 +262,8 @@ class setup_cmd_database extends setup_cmd
}
if (strpos($this->$name,'$domain') !== false)
{
$this->set_defaults[$name] = $this->$name = str_replace(array('$domain','.','-'),array($this->domain,'_','_'),$this->$name);
// limit names to 16 chars (16 char is user-name limit in MySQL)
$this->set_defaults[$name] = $this->$name = substr(str_replace(array('$domain','.','-'),array($this->domain,'_','_'),$this->$name),0,16);
}
}
}

View File

@ -247,7 +247,7 @@ class setup_detection
*/
function check_header()
{
if(!file_exists('../header.inc.php'))
if(!file_exists(EGW_SERVER_ROOT.'/header.inc.php'))
{
$GLOBALS['egw_info']['setup']['header_msg'] = 'Stage One';
return '1';

View File

@ -110,7 +110,7 @@ switch($action)
default:
// we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE
if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) &&
is_subclass_of($class,'admin_cmd') && constant($class.'::SETUP_CLI_CALLABLE'))
is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE'))
{
$args = array();
$args['domain'] = array_shift($arguments); // domain must be first argument, to ensure right domain get's selected in header-include