mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
offer to delete all existing accounts from SQL tables, before migration to it
This commit is contained in:
parent
a7944a3b76
commit
eaf3e6e1a5
@ -64,6 +64,7 @@ $cmd = new setup_cmd_ldap(array(
|
|||||||
'ldap_admin' => !empty($_POST['ldap_admin']) ? $_POST['ldap_admin'] : $GLOBALS['egw_info']['server']['ldap_root_dn'],
|
'ldap_admin' => !empty($_POST['ldap_admin']) ? $_POST['ldap_admin'] : $GLOBALS['egw_info']['server']['ldap_root_dn'],
|
||||||
'ldap_admin_pw' => !empty($_POST['ldap_admin']) ? $_POST['ldap_admin_pw'] : $GLOBALS['egw_info']['server']['ldap_root_pw'],
|
'ldap_admin_pw' => !empty($_POST['ldap_admin']) ? $_POST['ldap_admin_pw'] : $GLOBALS['egw_info']['server']['ldap_root_pw'],
|
||||||
'ldap_base' => implode(',',$base_parts),
|
'ldap_base' => implode(',',$base_parts),
|
||||||
|
'truncate_egw_accounts' => !empty($_POST['truncate_egw_accounts']),
|
||||||
)+$GLOBALS['egw_info']['server']);
|
)+$GLOBALS['egw_info']['server']);
|
||||||
|
|
||||||
if (!$_POST['migrate'])
|
if (!$_POST['migrate'])
|
||||||
@ -77,6 +78,7 @@ if (!$_POST['migrate'])
|
|||||||
$setup_tpl->set_block('migration','ldap_admin','ldap_admin');
|
$setup_tpl->set_block('migration','ldap_admin','ldap_admin');
|
||||||
$setup_tpl->set_block('migration','submit','submit');
|
$setup_tpl->set_block('migration','submit','submit');
|
||||||
$setup_tpl->set_block('migration','footer','footer');
|
$setup_tpl->set_block('migration','footer','footer');
|
||||||
|
$setup_tpl->set_block('migration','truncate_egw_accounts','truncate_egw_accounts');
|
||||||
|
|
||||||
foreach($accounts as $account_id => $account)
|
foreach($accounts as $account_id => $account)
|
||||||
{
|
{
|
||||||
@ -99,7 +101,7 @@ if (!$_POST['migrate'])
|
|||||||
$setup_tpl->set_var('users',$user_list);
|
$setup_tpl->set_var('users',$user_list);
|
||||||
$setup_tpl->set_var('groups',$group_list);
|
$setup_tpl->set_var('groups',$group_list);
|
||||||
|
|
||||||
$setup_tpl->set_var('description',lang('Migration between eGroupWare account repositories').': '.$direction);
|
$setup_tpl->set_var('description',lang('Migration between EGroupware account repositories').': '.$direction);
|
||||||
$setup_tpl->set_var('select_users',lang('Select which user(s) will be exported'));
|
$setup_tpl->set_var('select_users',lang('Select which user(s) will be exported'));
|
||||||
$setup_tpl->set_var('select_groups',lang('Select which group(s) will be exported'));
|
$setup_tpl->set_var('select_groups',lang('Select which group(s) will be exported'));
|
||||||
$setup_tpl->set_var('memberships',$identical_account_id_warning ?
|
$setup_tpl->set_var('memberships',$identical_account_id_warning ?
|
||||||
@ -124,6 +126,11 @@ if (!$_POST['migrate'])
|
|||||||
{
|
{
|
||||||
$setup_tpl->pfp('out','ldap_admin');
|
$setup_tpl->pfp('out','ldap_admin');
|
||||||
}
|
}
|
||||||
|
if ($to == 'sql')
|
||||||
|
{
|
||||||
|
$setup_tpl->set_var('truncate_egw_accounts_message', lang('Delete all existing accounts from SQL database'));
|
||||||
|
$setup_tpl->pfp('out','truncate_egw_accounts');
|
||||||
|
}
|
||||||
$setup_tpl->pfp('out','submit');
|
$setup_tpl->pfp('out','submit');
|
||||||
$setup_tpl->pfp('out','footer');
|
$setup_tpl->pfp('out','footer');
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,11 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
* @param string $ldap_group_context=null ou for groups, default "ou=groups,$base"
|
* @param string $ldap_group_context=null ou for groups, default "ou=groups,$base"
|
||||||
* @param string $sub_command='create_ldap' 'create_ldap', 'test_ldap', 'test_ldap_root', see exec method
|
* @param string $sub_command='create_ldap' 'create_ldap', 'test_ldap', 'test_ldap_root', see exec method
|
||||||
* @param string $ldap_encryption_type='des'
|
* @param string $ldap_encryption_type='des'
|
||||||
|
* @param boolean $truncate_egw_accounts=false truncate accounts table before migration to SQL
|
||||||
*/
|
*/
|
||||||
function __construct($domain,$ldap_host=null,$ldap_suffix=null,$ldap_admin=null,$ldap_admin_pw=null,
|
function __construct($domain,$ldap_host=null,$ldap_suffix=null,$ldap_admin=null,$ldap_admin_pw=null,
|
||||||
$ldap_base=null,$ldap_root_dn=null,$ldap_root_pw=null,$ldap_context=null,$ldap_search_filter=null,
|
$ldap_base=null,$ldap_root_dn=null,$ldap_root_pw=null,$ldap_context=null,$ldap_search_filter=null,
|
||||||
$ldap_group_context=null,$sub_command='create_ldap',$ldap_encryption_type='des')
|
$ldap_group_context=null,$sub_command='create_ldap',$ldap_encryption_type='des',$truncate_egw_accounts=false)
|
||||||
{
|
{
|
||||||
if (!is_array($domain))
|
if (!is_array($domain))
|
||||||
{
|
{
|
||||||
@ -69,6 +70,7 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
'ldap_group_context' => $ldap_group_context,
|
'ldap_group_context' => $ldap_group_context,
|
||||||
'sub_command' => $sub_command,
|
'sub_command' => $sub_command,
|
||||||
'ldap_encryption_type' => $ldap_encryption_type,
|
'ldap_encryption_type' => $ldap_encryption_type,
|
||||||
|
'truncate_egw_accounts' => $truncate_egw_accounts,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//echo __CLASS__.'::__construct()'; _debug_array($domain);
|
//echo __CLASS__.'::__construct()'; _debug_array($domain);
|
||||||
@ -145,12 +147,12 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
// read accounts from old store
|
// read accounts from old store
|
||||||
$accounts = $this->accounts(!$to_ldap);
|
$accounts = $this->accounts(!$to_ldap);
|
||||||
|
|
||||||
/* uncomment if you want to have SQL cleaned up before migration
|
// clean up SQL before migration
|
||||||
if (!$to_ldap)
|
if (!$to_ldap && $this->truncate_egw_accounts)
|
||||||
{
|
{
|
||||||
$GLOBALS['egw']->db->query('TRUNCATE TABLE egw_accounts', __LINE__, __FILE__);
|
$GLOBALS['egw']->db->query('TRUNCATE TABLE egw_accounts', __LINE__, __FILE__);
|
||||||
$GLOBALS['egw']->db->query('DELETE FROM egw_addressbook WHERE account_id IS NOT NULL', __LINE__, __FILE__);
|
$GLOBALS['egw']->db->query('DELETE FROM egw_addressbook WHERE account_id IS NOT NULL', __LINE__, __FILE__);
|
||||||
}*/
|
}
|
||||||
// instanciate accounts obj for new store
|
// instanciate accounts obj for new store
|
||||||
$accounts_obj = $this->accounts_obj($to_ldap);
|
$accounts_obj = $this->accounts_obj($to_ldap);
|
||||||
|
|
||||||
@ -224,6 +226,8 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
{
|
{
|
||||||
if (!isset($emailadmin_src))
|
if (!isset($emailadmin_src))
|
||||||
{
|
{
|
||||||
|
// add egw-pear to include_path, as setup does NOT do it (only includes common_functions.inc.php from API)
|
||||||
|
set_include_path(EGW_SERVER_ROOT.'/egw-pear'.PATH_SEPARATOR.get_include_path());
|
||||||
include_once(EGW_INCLUDE_ROOT.'/emailadmin/inc/class.'.$ldap_class.'.inc.php');
|
include_once(EGW_INCLUDE_ROOT.'/emailadmin/inc/class.'.$ldap_class.'.inc.php');
|
||||||
if ($to_ldap)
|
if ($to_ldap)
|
||||||
{
|
{
|
||||||
|
@ -37,6 +37,14 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<!-- END ldap_admin -->
|
<!-- END ldap_admin -->
|
||||||
|
|
||||||
|
<!-- BEGIN truncate_egw_accounts -->
|
||||||
|
<tr bgcolor="#e6e6e6">
|
||||||
|
<td colspan="2" align="center">
|
||||||
|
<label><input type="checkbox" name="truncate_egw_accounts">{truncate_egw_accounts_message}</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<!-- END truncate_egw_accounts -->
|
||||||
|
|
||||||
<!-- BEGIN submit -->
|
<!-- BEGIN submit -->
|
||||||
</tr>
|
</tr>
|
||||||
<tr bgcolor="#e6e6e6">
|
<tr bgcolor="#e6e6e6">
|
||||||
|
Loading…
Reference in New Issue
Block a user