mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
"- fixed wrong call $ids2change instead of $this->change
- egw_vfs --> egw_sqlfs"
This commit is contained in:
parent
51cd3ec0ba
commit
3fe7919b92
@ -61,7 +61,7 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
'egw_nextid' => false,
|
||||
'egw_preferences' => array(array('preference_owner','preference_owner > 0')),
|
||||
'egw_sessions' => false, // only account_lid stored
|
||||
'egw_vfs' => array('vfs_owner_id','vfs_createdby_id','vfs_modifiedby_id'), // 'vfs_directory' contains account_lid for /home/account
|
||||
'egw_sqlfs' => array('fs_uid','fs_creator','fs_modifier',array('fs_gid','.type' => 'absgroup')),
|
||||
),
|
||||
'etemplate' => array(
|
||||
'egw_etemplate' => 'et_group',
|
||||
@ -219,7 +219,7 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
$where = $column;
|
||||
$column = array_shift($where);
|
||||
}
|
||||
$total += ($changed = self::_update_account_id($ids2change,$db,$table,$column,$where,$type));
|
||||
$total += ($changed = self::_update_account_id($this->change,$db,$table,$column,$where,$type));
|
||||
echo "$app: $table.$column $changed id's changed\n";
|
||||
}
|
||||
}
|
||||
@ -230,14 +230,20 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
private static function _update_account_id($ids2change,$db,$table,$column,$where=null,$type=null)
|
||||
{
|
||||
static $update_sql;
|
||||
static $update_sql_abs;
|
||||
|
||||
if (is_null($update_sql))
|
||||
{
|
||||
foreach($ids2change as $from => $to)
|
||||
{
|
||||
$update_sql .= "WHEN $from THEN $to ";
|
||||
if ($to < 0 && $from < 0)
|
||||
{
|
||||
$update_sql_abs .= 'WHEN '.abs($from).' THEN '.abs($to).' ';
|
||||
}
|
||||
}
|
||||
$update_sql .= "END";
|
||||
$update_sql .= 'END';
|
||||
if ($update_sql_abs) $update_sql_abs .= 'END';
|
||||
}
|
||||
switch($type)
|
||||
{
|
||||
@ -268,6 +274,18 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
}
|
||||
break;
|
||||
|
||||
case 'absgroup':
|
||||
if (!$update_sql_abs) break; // no groups to change
|
||||
if (!$where) $where = array();
|
||||
$where[$column] = array();
|
||||
foreach(array_keys($ids2change) as $id)
|
||||
{
|
||||
if ($id < 0) $where[$column][] = abs($id);
|
||||
}
|
||||
$db->update($table,$column.'= CASE '.$column.' '.$update_sql_abs,$where,__LINE__,__FILE__);
|
||||
$changed = $db->affected_rows();
|
||||
break;
|
||||
|
||||
case 'abs':
|
||||
if (!$where) $where = array();
|
||||
$where[$column] = array();
|
||||
|
Loading…
Reference in New Issue
Block a user