Author: ralfbecker
New Revision: 55962
URL: http://svn.stylite.de/viewvc/egroupware?rev=55962&view=rev
Log:
using new api for setup
Modified:
trunk/setup/account_migration.php
trunk/setup/admin_account.php
trunk/setup/applications.php
trunk/setup/config.php
trunk/setup/db_backup.php
trunk/setup/inc/class.setup.inc.php
trunk/setup/inc/class.setup_cmd.inc.php
trunk/setup/inc/class.setup_cmd_admin.inc.php
trunk/setup/inc/class.setup_cmd_database.inc.php
trunk/setup/inc/class.setup_cmd_header.inc.php
trunk/setup/inc/class.setup_cmd_hooks.inc.php
trunk/setup/inc/class.setup_cmd_install.inc.php
trunk/setup/inc/class.setup_cmd_ldap.inc.php
trunk/setup/inc/class.setup_cmd_showheader.inc.php
trunk/setup/inc/class.setup_cmd_update.inc.php
trunk/setup/inc/class.setup_detection.inc.php
trunk/setup/inc/class.setup_header.inc.php
trunk/setup/inc/class.setup_html.inc.php
trunk/setup/inc/class.setup_process.inc.php
trunk/setup/inc/class.setup_translation.inc.php
trunk/setup/inc/functions.inc.php
trunk/setup/inc/hook_config.inc.php
trunk/setup/inc/hook_config_validate.inc.php
trunk/setup/index.php
trunk/setup/manageheader.php
trunk/setup/setup-cli.php
trunk/setup/sqltoarray.php
ā trunk/setup/account_migration.php (original)
+++ trunk/setup/account_migration.php Sun May 1 17:56:49 2016
@@ -1,6 +1,6 @@
<?php
/**
- * eGroupware Setup - Account migration between SQL <--> LDAP
+ * EGroupware Setup - Account migration between SQL <--> LDAP
*
* The migration is done to the account-repository configured for eGroupWare!
*
@@ -31,7 +31,7 @@
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl'
));
-$setup_tpl->set_var('hidden_vars', html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
+$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
// check CSRF token for POST requests with any content (setup uses empty POST to call it's modules!)
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST)
@@ -108,7 +108,7 @@
else
{
$user_list .= ''.
- common::display_fullname($account['account_lid'],
+ Api\Accounts::format_username($account['account_lid'],
$account['account_firstname'],$account['account_lastname']) . "\n";
}
}
@@ -129,7 +129,7 @@
$setup_tpl->set_var('cancel',lang('Cancel'));
if ($from == 'sql' && $GLOBALS['egw_info']['server']['auth_type'] == 'ldap')
{
- $setup_tpl->set_var('extra_button', html::submit_button('passwords2sql', lang('Passwords --> SQL')));
+ $setup_tpl->set_var('extra_button', Api\Html::submit_button('passwords2sql', lang('Passwords --> SQL')));
}
$setup_tpl->pfp('out','header');
@@ -163,10 +163,10 @@
// store new repostory (and auth_type), as we are migrated now
if ($_POST['migrate'])
{
- config::save_value('account_repository', $GLOBALS['egw_info']['server']['account_repository']=$to, 'phpgwapi');
+ Api\Config::save_value('account_repository', $GLOBALS['egw_info']['server']['account_repository']=$to, 'phpgwapi');
if (empty($GLOBALS['egw_info']['server']['auth_type']) || $GLOBALS['egw_info']['server']['auth_type'] == $from)
{
- config::save_value('auth_type', $GLOBALS['egw_info']['server']['auth_type']=$to, 'phpgwapi');
+ Api\Config::save_value('auth_type', $GLOBALS['egw_info']['server']['auth_type']=$to, 'phpgwapi');
}
}
echo '
'.lang('Click here to return to setup.')."
\n";
Modified: trunk/setup/admin_account.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/admin_account.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/admin_account.php (original)
+++ trunk/setup/admin_account.php Sun May 1 17:56:49 2016
@@ -1,6 +1,6 @@
<?php
/**
- * eGroupware Setup - create admin account
+ * EGroupware Setup - create admin account
*
* @link http://www.egroupware.org
* @package setup
@@ -11,6 +11,7 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Framework;
if (strpos($_SERVER['PHP_SELF'],'admin_account.php') !== false)
{
@@ -54,7 +55,7 @@
if(!$_POST['submit'] || $error)
{
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
- $setup_tpl = new Template($tpl_root);
+ $setup_tpl = new Framework\Template($tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
@@ -91,7 +92,7 @@
$setup_tpl->set_var('create_demo_accounts',lang('Create demo accounts'));
$setup_tpl->set_var('demo_desc',lang('The username/passwords are: demo/guest, demo2/guest and demo3/guest.'));
- $setup_tpl->set_var('hidden_vars', html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
+ $setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
$setup_tpl->set_var('lang_submit',lang('Save'));
$setup_tpl->set_var('lang_cancel',lang('Cancel'));
Modified: trunk/setup/applications.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/applications.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/applications.php (original)
+++ trunk/setup/applications.php Sun May 1 17:56:49 2016
@@ -1,6 +1,6 @@
<?php
/**
- * eGroupware Setup - Install, update & remove single apps
+ * EGroupware Setup - Install, update & remove single apps
*
* @link http://www.egroupware.org
* @package setup
@@ -11,6 +11,7 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Framework;
$DEBUG = @$_POST['debug'] || @$_GET['debug'];
/*
@@ -33,7 +34,7 @@
// Does not return unless user is authorized
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
-$setup_tpl = new Template($tpl_root);
+$setup_tpl = new Framework\Template($tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
Modified: trunk/setup/config.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/config.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/config.php (original)
+++ trunk/setup/config.php Sun May 1 17:56:49 2016
@@ -1,6 +1,6 @@
<?php
/**
- * eGroupWare Setup - System configuration
+ * EGroupWare Setup - System configuration
*
* @link http://www.egroupware.org
* @package setup
@@ -11,6 +11,7 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Framework;
include('./inc/functions.inc.php');
@@ -25,7 +26,7 @@
}
$tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup');
-$setup_tpl = new Template($tpl_root);
+$setup_tpl = new Framework\Template($tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
@@ -34,7 +35,7 @@
'T_config_pre_script' => 'config_pre_script.tpl',
'T_config_post_script' => 'config_post_script.tpl'
));
-$setup_tpl->set_var('hidden_vars', html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
+$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
// check CSRF token for POST requests with any content (setup uses empty POST to call it's modules!)
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST)
@@ -120,7 +121,7 @@
$GLOBALS['egw'] = new phpgw;
$GLOBALS['egw']->db =& $GLOBALS['egw_setup']->db;
-$t = new Template(common::get_tpl_dir('setup'));
+$t = new Framework\Template(Framework\Template::get_dir('setup'));
$t->set_unknowns('keep');
$t->set_file(array('config' => 'config.tpl'));
Modified: trunk/setup/db_backup.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/db_backup.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/db_backup.php (original)
+++ trunk/setup/db_backup.php Sun May 1 17:56:49 2016
@@ -1,6 +1,6 @@
<?php
/**
- * eGroupWare Setup - DB backup and restore
+ * EGroupware Setup - DB backup and restore
*
* @link http://www.egroupware.org
* @package setup
@@ -10,6 +10,9 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Egw;
+use EGroupware\Api\Vfs;
if (!is_object(@$GLOBALS['egw'])) // called from outside eGW ==> setup
{
@@ -32,7 +35,7 @@
$is_setup = true;
}
$db_backup = new Api\Db\Backup();
-$asyncservice = new asyncservice();
+$asyncservice = new Api\AsyncService();
// download a backup, has to be before any output !!!
if ($_POST['download'])
@@ -41,17 +44,17 @@
$file = $db_backup->backup_dir.'/'.basename($file); // basename to now allow to change the dir
while (@ob_end_clean()) {} // end all active output buffering
ini_set('zlib.output_compression',0); // switch off zlib.output_compression, as this would limit downloads in size to memory_limit
- html::content_header(basename($file));
+ Api\Header\Content::type(basename($file));
readfile($file);
exit;
}
-$setup_tpl = new Template($tpl_root);
+$setup_tpl = new Framework\Template($tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_db_backup' => 'db_backup.tpl',
));
-$setup_tpl->set_var('hidden_vars', html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
+$setup_tpl->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__FILE__)));
// check CSRF token for POST requests with any content (setup uses empty POST to call it's modules!)
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST)
@@ -76,7 +79,7 @@
$setup_tpl->set_block('T_db_backup','setup_header');
$setup_tpl->set_var('setup_header','');
$GLOBALS['egw_info']['flags']['app_header'] = $stage_title;
- common::egw_header();
+ $GLOBALS['egw']->framework->header();
parse_navbar();
$run_in_egw = true;
}
@@ -107,13 +110,13 @@
}
if ($_POST['mount'])
{
- Api\Vfs::$is_root = true;
+ Vfs::$is_root = true;
echo '
'.
- (Api\Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070','/backup',false) ?
+ (Vfs::mount('filesystem://default'.$db_backup->backup_dir.'?group=Admins&mode=070','/backup',false) ?
lang('Backup directory %1 mounted as %2',$db_backup->backup_dir,'/backup') :
lang('Failed to mount Backup directory!')).
"
\n";
- Api\Vfs::$is_root = false;
+ Vfs::$is_root = false;
}
// create a backup now
if($_POST['backup'])
@@ -204,7 +207,7 @@
$GLOBALS['egw_info']['server']['header_admin_user']='admin',
$GLOBALS['egw_info']['server']['header_admin_password']=uniqid('pw',true),false,true);
echo $cmd->run()."\n";
- echo '
'.lang('You should %1log out%2 and in again, to update your current session!','','')."
\n";
+ echo '
'.lang('You should %1log out%2 and in again, to update your current session!','','')."
\n";
}
}
else
@@ -301,7 +304,7 @@
if ($run_in_egw)
{
- common::egw_footer();
+ $GLOBALS['egw']->framework->footer();
}
else
{
Modified: trunk/setup/inc/class.setup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup.inc.php (original)
+++ trunk/setup/inc/class.setup.inc.php Sun May 1 17:56:49 2016
@@ -14,6 +14,9 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Link;
+use EGroupware\Api\Egw;
+use EGroupware\Api\Vfs;
class setup
{
@@ -77,8 +80,7 @@
if (!is_object($GLOBALS['egw']))
{
- require_once(EGW_API_INC.'/class.egw.inc.php');
- $GLOBALS['phpgw'] = $GLOBALS['egw'] = new egw_minimal();
+ $GLOBALS['phpgw'] = $GLOBALS['egw'] = new Egw\Base();
}
$this->detection = new setup_detection();
$this->process = new setup_process();
@@ -631,7 +633,7 @@
$this->db->delete($this->applications_table,array('app_name'=>$appname),__LINE__,__FILE__);
// Remove links to the app
- Api\Link::unlink(0, $appname);
+ Link::unlink(0, $appname);
$this->clear_session_cache();
}
@@ -903,7 +905,7 @@
/**
* Own instance of the accounts class
*
- * @var accounts
+ * @var Api\Accounts
*/
var $accounts;
@@ -1009,19 +1011,19 @@
return false;
}
}
- // call Api\Vfs\Hooks::add{account|group} hook to create the vfs-home-dirs
+ // call Vfs\Hooks::add{account|group} hook to create the vfs-home-dirs
// calling general add{account|group} hook fails, as we are only in setup
// --> setup_cmd_admin execs "admin/admin-cli.php --edit-user" to run them
if ($primary_group)
{
- Api\Vfs\Hooks::addAccount(array(
+ Vfs\Hooks::addAccount(array(
'account_id' => $accountid,
'account_lid' => $username,
));
}
else
{
- Api\Vfs\Hooks::addGroup(array(
+ Vfs\Hooks::addGroup(array(
'account_id' => $accountid,
'account_lid' => $username,
));
@@ -1071,7 +1073,7 @@
$this->accounts->search(array(
'type' => 'accounts',
'start' => 0,
- 'offset' => 2 // we only need to check 2 accounts, if we just check for not anonymous
+ 'offset' => 2 // we only need to check 2 Api\Accounts, if we just check for not anonymous
));
return $this->accounts->total > 1;
Modified: trunk/setup/inc/class.setup_cmd.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd.inc.php Sun May 1 17:56:49 2016
@@ -10,6 +10,7 @@
* @version $Id$
*/
+use EGroupware\Api;
use EGroupware\Api\Egw;
/**
@@ -27,7 +28,7 @@
/**
* Should be called by every command usually requiring header admin rights
*
- * @throws egw_exception_no_permission(lang('Wrong credentials to access the header.inc.php file!'),2);
+ * @throws Api\Exception\NoPermission(lang('Wrong credentials to access the header.inc.php file!'),2);
*/
protected function _check_header_access()
{
@@ -43,7 +44,7 @@
if ($this->header_secret != $secret)
{
//echo "_check_header_access: header_secret='$this->header_secret' != '$secret'=_calc_header_secret({$GLOBALS['egw_info']['server']['header_admin_user']},{$GLOBALS['egw_info']['server']['header_admin_password']})\n";
- throw new egw_exception_no_permission(lang('Wrong credentials to access the header.inc.php file!'),5);
+ throw new Api\Exception\NoPermission(lang('Wrong credentials to access the header.inc.php file!'),5);
}
}
@@ -139,10 +140,10 @@
if (is_object($GLOBALS['egw']->db) && $domain)
{
$GLOBALS['egw']->db->disconnect();
- $GLOBALS['egw']->db = new egw_db($GLOBALS['egw_domain'][$domain]);
+ $GLOBALS['egw']->db = new Api\Db($GLOBALS['egw_domain'][$domain]);
// change caching to managed instance
- egw_cache::unset_instance_key();
+ Api\Cache::unset_instance_key();
}
}
@@ -155,15 +156,15 @@
if (is_object($GLOBALS['egw']->db))
{
$GLOBALS['egw']->db->disconnect();
- $GLOBALS['egw']->db = new egw_db($GLOBALS['egw_info']['server']);
+ $GLOBALS['egw']->db = new Api\Db($GLOBALS['egw_info']['server']);
// change caching back to own instance
- egw_cache::unset_instance_key();
+ Api\Cache::unset_instance_key();
if (!is_null(self::$egw_accounts_backup))
{
$GLOBALS['egw']->accounts = self::$egw_accounts_backup;
- accounts::cache_invalidate();
+ Api\Accounts::cache_invalidate();
unset(self::$egw_accounts_backup);
}
}
@@ -175,8 +176,8 @@
* @param string $user
* @param string $pw
* @param string $domain =null if given we also check agains config user/pw
- * @throws egw_exception_no_permission(lang('Access denied: wrong username or password for manage-header !!!'),21);
- * @throws egw_exception_no_permission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40);
+ * @throws Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21);
+ * @throws Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40);
*/
static function check_setup_auth($user,$pw,$domain=null)
{
@@ -193,11 +194,11 @@
{
if (is_null($domain))
{
- throw new egw_exception_no_permission(lang('Access denied: wrong username or password for manage-header !!!'),21);
+ throw new Api\Exception\NoPermission(lang('Access denied: wrong username or password for manage-header !!!'),21);
}
else
{
- throw new egw_exception_no_permission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40);
+ throw new Api\Exception\NoPermission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40);
}
}
}
@@ -243,7 +244,7 @@
{
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 ;-)
+ throw new Api\Exception\WrongUserinput(lang("eGroupWare sources in '%1' are not complete, file '%2' missing !!!",realpath('..'),'phpgwapi/setup/setup.inc.php'),99); // should not happen ;-)
}
$versions['phpgwapi'] = $setup_info['phpgwapi']['version'];
unset($setup_info);
@@ -257,13 +258,13 @@
switch ($header_stage)
{
- case 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);
-
-// case 2: throw new egw_exception_wrong_userinput(lang('eGroupWare configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No header admin password set! Use --edit-header [,] to set one (--usage gives more options).'),2);
-
- case 3: throw new egw_exception_wrong_userinput(lang('eGroupWare configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No eGroupWare domains / database instances exist! Use --edit-header --domain to add one (--usage gives more options).'),3);
-
- case 4: throw new egw_exception_wrong_userinput(lang('eGroupWare configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('It needs upgrading to version %1! Use --update-header [,] to do so (--usage gives more options).',$versions['current_header']),4);
+ case 1: throw new Api\Exception\WrongUserinput(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);
+
+// case 2: throw new Api\Exception\WrongUserinput(lang('eGroupWare configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No header admin password set! Use --edit-header [,] to set one (--usage gives more options).'),2);
+
+ case 3: throw new Api\Exception\WrongUserinput(lang('eGroupWare configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('No eGroupWare domains / database instances exist! Use --edit-header --domain to add one (--usage gives more options).'),3);
+
+ case 4: throw new Api\Exception\WrongUserinput(lang('eGroupWare configuration file (header.inc.php) version %1 exists%2',$versions['header'],'.')."\n".lang('It needs upgrading to version %1! Use --update-header [,] to do so (--usage gives more options).',$versions['current_header']),4);
}
if ($header_checks)
{
@@ -275,7 +276,7 @@
$domains = $GLOBALS['egw_domain'];
if ($domain) // domain to check given
{
- if (!isset($GLOBALS['egw_domain'][$domain])) throw new egw_exception_wrong_userinput(lang("Domain '%1' does NOT exist !!!",$domain), 92);
+ if (!isset($GLOBALS['egw_domain'][$domain])) throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!",$domain), 92);
$domains = array($domain => $GLOBALS['egw_domain'][$domain]);
}
@@ -309,11 +310,11 @@
}
switch($db_stage)
{
- case 1: throw new egw_exception_wrong_userinput(lang('Your Database is not working!')." $db: ".self::$egw_setup->db->Error,11);
-
- case 3: throw new egw_exception_wrong_userinput(lang('Your database is working, but you dont have any applications installed')." ($db). ".lang("Use --install to install eGroupWare."),13);
-
- case 4: throw new egw_exception_wrong_userinput(lang('eGroupWare API needs a database (schema) update from version %1 to %2!',$setup_info['phpgwapi']['currentver'],$versions['phpgwapi']).' '.lang('Use --update to do so.'),14);
+ case 1: throw new Api\Exception\WrongUserinput(lang('Your Database is not working!')." $db: ".self::$egw_setup->db->Error,11);
+
+ case 3: throw new Api\Exception\WrongUserinput(lang('Your database is working, but you dont have any applications installed')." ($db). ".lang("Use --install to install eGroupWare."),13);
+
+ case 4: throw new Api\Exception\WrongUserinput(lang('eGroupWare API needs a database (schema) update from version %1 to %2!',$setup_info['phpgwapi']['currentver'],$versions['phpgwapi']).' '.lang('Use --update to do so.'),14);
case 10: // also check apps of updates
self::$apps_to_upgrade = self::$apps_to_install = array();
@@ -338,7 +339,7 @@
$db_stage = 4;
if ($stop && in_array(10+$db_stage,$stop)) return $messages;
- throw new egw_exception_wrong_userinput(lang('The following applications need to be upgraded:').' '.implode(', ',self::$apps_to_upgrade).'! '.lang('Use --update to do so.'),14);
+ throw new Api\Exception\WrongUserinput(lang('The following applications need to be upgraded:').' '.implode(', ',self::$apps_to_upgrade).'! '.lang('Use --update to do so.'),14);
}
break;
}
@@ -347,7 +348,7 @@
self::$egw_setup->detection->check_config();
if ($GLOBALS['egw_info']['setup']['config_errors'] && $stop && !in_array(15,$stop))
{
- throw new egw_exception_wrong_userinput(lang('You need to configure eGroupWare:')."\n- ".@implode("\n- ",$GLOBALS['egw_info']['setup']['config_errors']),15);
+ throw new Api\Exception\WrongUserinput(lang('You need to configure eGroupWare:')."\n- ".@implode("\n- ",$GLOBALS['egw_info']['setup']['config_errors']),15);
}
}
return $messages;
Modified: trunk/setup/inc/class.setup_cmd_admin.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd_admin.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd_admin.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd_admin.inc.php Sun May 1 17:56:49 2016
@@ -5,10 +5,12 @@
* @link http://www.egroupware.org
* @author Ralf Becker
* @package setup
- * @copyright (c) 2007-10 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
/**
* setup command: create a first eGroupWare user / admin and our two standard groups: Default & Admins
@@ -26,15 +28,15 @@
* Constructor
*
* @param string|array $domain domain-name or array with all parameters
- * @param string $config_user=null user to config the domain (or header_admin_user)
- * @param string $config_passwd=null pw of above user
- * @param string $admin_user=null
- * @param string $admin_password=null
- * @param string $admin_firstname=null
- * @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'
+ * @param string $config_user =null user to config the domain (or header_admin_user)
+ * @param string $config_passwd =null pw of above user
+ * @param string $admin_user =null
+ * @param string $admin_password =null
+ * @param string $admin_firstname =null
+ * @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(),$lang='en')
@@ -61,7 +63,7 @@
/**
* 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
+ * @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);
* @throws Exception('header.inc.php not found!');
@@ -97,25 +99,26 @@
switch ($error)
{
case 41:
- throw new egw_exception_wrong_userinput(lang('Error in admin-creation !!!'),41);
+ throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'),41);
case 42:
- throw new egw_exception_wrong_userinput(lang('Error in group-creation !!!'),42);
+ throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'),42);
}
$this->restore_db();
- // run admin/admin-cli.php --add-user to store the new accounts once in EGroupware
+ // run admin/admin-cli.php --add-user to store the new Api\Accounts once in EGroupware
// to run all hooks (some of them can NOT run inside setup)
$cmd = EGW_SERVER_ROOT.'/admin/admin-cli.php --add-user '.
escapeshellarg($this->admin_user.'@'.$this->domain.','.$this->admin_password.','.$this->admin_user);
if (php_sapi_name() !== 'cli' || !file_exists(EGW_SERVER_ROOT.'/stylite') || file_exists(EGW_SERVER_ROOT.'/managementserver'))
{
+ $output = $ret = null;
exec($cmd,$output,$ret);
}
$output = implode("\n",$output);
//echo "ret=$ret\n".$output;
if ($ret)
{
- throw new egw_exception ($output,$ret);
+ throw new Api\Exception ($output,$ret);
}
return lang('Admin account successful created.');
}
Modified: trunk/setup/inc/class.setup_cmd_database.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd_database.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd_database.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd_database.inc.php Sun May 1 17:56:49 2016
@@ -5,10 +5,12 @@
* @link http://www.egroupware.org
* @author Ralf Becker
* @package setup
- * @copyright (c) 2007-10 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
/**
* setup command: test or create the database
@@ -28,9 +30,9 @@
const MAX_DB_NAME_LEN = 16;
/**
- * Instance of egw_db to connect or create the db
- *
- * @var egw_db
+ * Instance of Api\Db to connect or create the db
+ *
+ * @var Api\Db
*/
private $test_db;
@@ -39,16 +41,16 @@
*
* @param string/array $domain domain-name to customize the defaults or array with all parameters
* @param string $db_type db-type (mysql, pgsql, ...)
- * @param string $db_host=null
- * @param string $db_port=null
- * @param string $db_name=null
- * @param string $db_user=null
- * @param string $db_pass=null
- * @param string $db_root=null
- * @param string $db_root_pw=null
- * @param string $sub_command='create_db' 'create_db', 'test_db', 'test_db_root'
- * @param string $db_grant_host='localhost' host/ip of webserver for grant
- * @param boolean $make_db_name_unique=false true: if create fails because db exists,
+ * @param string $db_host =null
+ * @param string $db_port =null
+ * @param string $db_name =null
+ * @param string $db_user =null
+ * @param string $db_pass =null
+ * @param string $db_root =null
+ * @param string $db_root_pw =null
+ * @param string $sub_command ='create_db' 'create_db', 'test_db', 'test_db_root'
+ * @param string $db_grant_host ='localhost' host/ip of webserver for grant
+ * @param boolean $make_db_name_unique =false true: if create fails because db exists,
* try creating a unique name by shortening the name and adding a number to it
*/
function __construct($domain,$db_type=null,$db_host=null,$db_port=null,$db_name=null,$db_user=null,$db_pass=null,
@@ -78,7 +80,7 @@
/**
* run the command: test or create database
*
- * @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 success message
* @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2);
* @throws Exception('header.inc.php not found!');
@@ -87,7 +89,7 @@
{
if (!empty($this->domain) && !preg_match('/^([a-z0-9_-]+\.)*[a-z0-9]+/i',$this->domain))
{
- throw new egw_exception_wrong_userinput(lang("'%1' is no valid domain name!",$this->domain));
+ throw new Api\Exception\WrongUserinput(lang("'%1' is no valid domain name!",$this->domain));
}
if ($this->remote_id && $check_only) return true; // further checks can only done locally
@@ -127,10 +129,10 @@
/**
* Connect to database
*
- * @param string $user=null default $this->db_user
- * @param string $pass=null default $this->db_pass
- * @param string $name=null default $this->db_name
- * @throws egw_exception_wrong_userinput Can not connect to database ...
+ * @param string $user =null default $this->db_user
+ * @param string $pass =null default $this->db_pass
+ * @param string $name =null default $this->db_name
+ * @throws Api\Exception\WrongUserinput Can not connect to database ...
*/
private function connect($user=null,$pass=null,$name=null)
{
@@ -138,7 +140,7 @@
if (is_null($pass)) $pass = $this->db_pass;
if (is_null($name)) $name = $this->db_name;
- $this->test_db = new egw_db();
+ $this->test_db = new Api\Db();
$error_rep = error_reporting();
error_reporting($error_rep & ~E_WARNING); // switch warnings of, in case they are on
@@ -152,7 +154,7 @@
if ($e)
{
- throw new egw_exception_wrong_userinput(lang('Can not connect to %1 database %2 on host %3 using user %4!',
+ throw new Api\Exception\WrongUserinput(lang('Can not connect to %1 database %2 on host %3 using user %4!',
$this->db_type,$name,$this->db_host.($this->db_port?':'.$this->db_port:''),$user).' ('.$e->getMessage().')');
}
return lang('Successful connected to %1 database %2 on %3 using user %4.',
@@ -168,7 +170,7 @@
* added to $this->db_name AND $this->db_user, if db already exists.
*
* @return string with success message
- * @throws egw_exception_wrong_userinput
+ * @throws Api\Exception\WrongUserinput
*/
private function create()
{
@@ -184,13 +186,13 @@
try {
$msg = $this->connect();
}
- catch (egw_exception_wrong_userinput $e) {
+ catch (Api\Exception\WrongUserinput $e) {
// db or user not working --> connect as root and create it
try {
$this->test_db->create_database($this->db_root,$this->db_root_pw,$this->db_charset,$this->db_grant_host);
$this->connect();
}
- catch(egw_exception_db $e) { // catches failed to create database
+ catch(Api\Db\Exception $e) { // catches failed to create database
// try connect as root to check if wrong root/root_pw is the problem
$this->connect($this->db_root,$this->db_root_pw,$this->db_meta);
@@ -201,6 +203,7 @@
try {
$this->connect($this->db_root,$this->db_root_pw);
// create new db_name by incrementing an existing numeric postfix
+ $matches = null;
if (preg_match('/([0-9]+)$/',$this->db_name,$matches))
{
$num = (string)(++$matches[1]);
@@ -215,13 +218,13 @@
return $this->create();
}
- catch (egw_exception_wrong_userinput $e2)
+ catch (Api\Exception\WrongUserinput $e2)
{
// we can NOT connect to db as root --> ignore exception to give general error
}
}
// if not give general error
- throw new egw_exception_wrong_userinput(lang('Can not create %1 database %2 on %3 for user %4!',
+ throw new Api\Exception\WrongUserinput(lang('Can not create %1 database %2 on %3 for user %4!',
$this->db_type,$this->db_name,$this->db_host.($this->db_port?':'.$this->db_port:''),$this->db_user));
}
$msg = lang('Successful connected to %1 on %3 and created database %2 for user %4.',
@@ -234,7 +237,7 @@
{
$table = $table['table_name'];
}
- throw new egw_exception_wrong_userinput(lang('%1 database %2 on %3 already contains the following tables:',
+ throw new Api\Exception\WrongUserinput(lang('%1 database %2 on %3 already contains the following tables:',
$this->db_type,$this->db_name,$this->db_host.($this->db_port?':'.$this->db_port:'')).' '.
implode(', ',$tables));
}
@@ -245,8 +248,8 @@
* Drop database and user
*
* @return string with success message
- * @throws egw_exception_wrong_userinput
- * @throws egw_db_exception if database not exist
+ * @throws Api\Exception\WrongUserinput
+ * @throws Api\Db\Exception if database not exist
*/
private function drop()
{
@@ -257,7 +260,8 @@
$this->test_db->query('DROP USER '.$this->test_db->quote($this->db_user).'@'.
$this->test_db->quote($this->db_grant_host?$this->db_grant_host:'%'),__LINE__,__FILE__);
}
- catch (egw_db_exception $e) {
+ catch (Api\Db\Exception $e) {
+ unset($e);
// we make this no fatal error, as the granthost might be something else ...
$msg .= ' '.lang('Error dropping User!');
}
@@ -267,7 +271,7 @@
/**
* Return default database settings for a given domain
*
- * @param string $db_type='mysql'
+ * @param string $db_type ='mysqli'
* @return array
*/
static function defaults($db_type='mysqli')
Modified: trunk/setup/inc/class.setup_cmd_header.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd_header.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd_header.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd_header.inc.php Sun May 1 17:56:49 2016
@@ -5,10 +5,12 @@
* @link http://www.egroupware.org
* @author Ralf Becker
* @package setup
- * @copyright (c) 2007/8 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
/**
* setup command: create or update the header.inc.php
@@ -33,8 +35,8 @@
/**
* Constructor
*
- * @param string/array $sub_command='create' 'create','edit','delete'(-domain) or array with all arguments
- * @param array $arguments=null comand line arguments
+ * @param string|array $sub_command ='create' 'create','edit','delete'(-domain) or array with all arguments
+ * @param array $arguments =null comand line arguments
*/
function __construct($sub_command='create',$arguments=null)
{
@@ -66,7 +68,7 @@
/**
* 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
* @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2);
* @throws Exception('header.inc.php not found!');
@@ -81,7 +83,7 @@
{
if ($this->sub_command != 'create')
{
- 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 Api\Exception\WrongUserinput(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->defaults(false);
}
@@ -89,7 +91,7 @@
{
if ($this->sub_command == 'create')
{
- throw new egw_exception_wrong_userinput(
+ throw new Api\Exception\WrongUserinput(
lang('eGroupWare configuration file header.inc.php already exists, you need to use --edit-header or delete it first!'),20);
}
if ($this->arguments)
@@ -123,7 +125,7 @@
echo '$GLOBALS[egw_info] = '; print_r($GLOBALS['egw_info']);
echo '$GLOBALS[egw_domain] = '; print_r($GLOBALS['egw_domain']);
}
- throw new egw_exception_wrong_userinput(lang('Configuration errors:')."\n- ".implode("\n- ",$errors)."\n".lang("You need to fix the above errors, before the configuration file header.inc.php can be written!"),23);
+ throw new Api\Exception\WrongUserinput(lang('Configuration errors:')."\n- ".implode("\n- ",$errors)."\n".lang("You need to fix the above errors, before the configuration file header.inc.php can be written!"),23);
}
if ($check_only)
{
@@ -142,20 +144,20 @@
{
unlink($this->header_path);
}
- if (($f = fopen($this->header_path,'wb')) && ($w=fwrite($f,$header)))
+ if (($f = fopen($this->header_path,'wb')) && fwrite($f,$header))
{
fclose($f);
return lang('header.inc.php successful written.');
}
}
- throw new egw_exception_no_permission(lang("Failed writing configuration file header.inc.php, check the permissions !!!"),24);
+ throw new Api\Exception\NoPermission(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
+ * @param array $args =null
* @return mixed
*/
function __call($method,array $args=null)
@@ -271,18 +273,18 @@
if (!isset(self::$options[$arg]))
{
- throw new egw_exception_wrong_userinput(lang("Unknown option '%1' !!!",$arg),90);
+ throw new Api\Exception\WrongUserinput(lang("Unknown option '%1' !!!",$arg),90);
}
$option = self::$options[$arg];
- $values = !is_array($option) ? array($values) : explode(',',$values);
+ $vals = !is_array($option) ? array($values) : explode(',',$values);
if (!is_array($option)) $option = array($option => $option);
$n = 0;
foreach($option as $name => $data)
{
- if ($n >= count($values)) break;
-
- $this->_parse_value($arg,$name,$data,$values[$n++]);
+ if ($n >= count($vals)) break;
+
+ $this->_parse_value($arg,$name,$data,$vals[$n++]);
}
}
}
@@ -296,7 +298,7 @@
{
if (!isset($GLOBALS['egw_domain'][$domain]))
{
- throw new egw_exception_wrong_userinput(lang("Domain '%1' does NOT exist !!!",$domain),92);
+ throw new Api\Exception\WrongUserinput(lang("Domain '%1' does NOT exist !!!",$domain),92);
}
unset($GLOBALS['egw_domain'][$domain]);
}
@@ -311,7 +313,7 @@
*/
private function _parse_value($arg,$name,$data,$value)
{
- static $domain;
+ static $domain=null;
if (!is_array($data)) $data = array('type' => $data);
$type = $data['type'];
@@ -320,7 +322,7 @@
{
if (!isset($data['allowed'][$value]))
{
- throw new egw_exception_wrong_userinput(lang("'%1' is not allowed as %2. arguments of option %3 !!!",$value,1+$n,$arg),91);
+ throw new Api\Exception\WrongUserinput(lang("'%1' is not allowed as %2. arguments of option %3 !!!",$value,1,$arg),91);
}
$value = $data['allowed'][$value];
}
@@ -359,6 +361,6 @@
{
$var =& $var[$name];
}
- $var = strpos($name,'passw') !== false ? md5($value) : $value;
+ if (true) $var = strpos($name,'passw') !== false ? md5($value) : $value;
}
}
Modified: trunk/setup/inc/class.setup_cmd_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd_hooks.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd_hooks.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd_hooks.inc.php Sun May 1 17:56:49 2016
@@ -5,7 +5,7 @@
* @link http://www.egroupware.org
* @author Ralf Becker
* @package setup
- * @copyright (c) 2011 by Ralf Becker
+ * @copyright (c) 2011-16 by Ralf Becker
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
@@ -40,7 +40,7 @@
/**
* run the command: register all hooks
*
- * @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 success message
* @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2);
* @throws Exception('header.inc.php not found!');
Modified: trunk/setup/inc/class.setup_cmd_install.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd_install.inc.php?rev=55962&r1=55961&r2=55962&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd_install.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd_install.inc.php Sun May 1 17:56:49 2016
@@ -5,10 +5,12 @@
* @link http://www.egroupware.org
* @author Ralf Becker
* @package setup
- * @copyright (c) 2007 by Ralf Becker
+ * @copyright (c) 2007-16 by Ralf Becker
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
/**
* setup command: install the tables
@@ -24,13 +26,13 @@
* Constructor
*
* @param string $domain string with domain-name or array with all arguments
- * @param string $config_user=null user to config the domain (or header_admin_user)
- * @param string $config_passwd=null pw of above user
- * @param string $backup=null filename of backup to use instead of new install, default new install
- * @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'
+ * @param string $config_user =null user to config the domain (or header_admin_user)
+ * @param string $config_passwd =null pw of above user
+ * @param string $backup =null filename of backup to use instead of new install, default new install
+ * @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,array $config=array(),$lang='en')
{
@@ -58,13 +60,14 @@
/**
* run the command: install the tables
*
- * @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
* @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2);
* @throws Exception('header.inc.php not found!');
*/
protected function exec($check_only=false)
{
+ unset($check_only); // not used;
global $setup_info;
// instanciate setup object and check authorisation
@@ -79,7 +82,7 @@
if (!is_resource($f = $db_backup->fopen_backup($this->backup,true)))
{
- throw new egw_exception_wrong_userinput(lang('Restore failed').' ('.$f.')',31);
+ throw new Api\Exception\WrongUserinput(lang('Restore failed').' ('.$f.')',31);
}
if ($this->verbose)
{
@@ -101,7 +104,7 @@
// regular (new) install
if ($GLOBALS['egw_info']['setup']['stage']['db'] != 3)
{
- throw new egw_exception_wrong_userinput(lang('eGroupWare is already installed!'),30);
+ throw new Api\Exception\Wron