From 58993cfb7bf20128c7f08db18e14fcfde2288275 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 26 Jul 2010 08:20:14 +0000 Subject: [PATCH] - 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 --- setup/inc/class.setup_cmd.inc.php | 2 +- setup/inc/class.setup_cmd_admin.inc.php | 5 +++++ setup/inc/class.setup_cmd_database.inc.php | 5 +++-- setup/inc/class.setup_detection.inc.php | 2 +- setup/setup-cli.php | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/setup/inc/class.setup_cmd.inc.php b/setup/inc/class.setup_cmd.inc.php index 24df36983a..dabfe411c0 100644 --- a/setup/inc/class.setup_cmd.inc.php +++ b/setup/inc/class.setup_cmd.inc.php @@ -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 ;-) } diff --git a/setup/inc/class.setup_cmd_admin.inc.php b/setup/inc/class.setup_cmd_admin.inc.php index d16826b1b9..99ef65e997 100644 --- a/setup/inc/class.setup_cmd_admin.inc.php +++ b/setup/inc/class.setup_cmd_admin.inc.php @@ -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 * diff --git a/setup/inc/class.setup_cmd_database.inc.php b/setup/inc/class.setup_cmd_database.inc.php index 938f94503e..87f031e19e 100644 --- a/setup/inc/class.setup_cmd_database.inc.php +++ b/setup/inc/class.setup_cmd_database.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package setup - * @copyright (c) 2007 by Ralf Becker + * @copyright (c) 2007-10 by Ralf Becker * @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); } } } diff --git a/setup/inc/class.setup_detection.inc.php b/setup/inc/class.setup_detection.inc.php index 87ae54ebf6..dbf9c76072 100755 --- a/setup/inc/class.setup_detection.inc.php +++ b/setup/inc/class.setup_detection.inc.php @@ -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'; diff --git a/setup/setup-cli.php b/setup/setup-cli.php index b26d0f21b1..b6edc9d8fb 100755 --- a/setup/setup-cli.php +++ b/setup/setup-cli.php @@ -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