implemented moving of data to an other account on deleting an account

This commit is contained in:
Ralf Becker 2008-04-19 09:14:59 +00:00
parent 13cf2edabb
commit 24989686df

View File

@ -68,14 +68,20 @@ class vfs_home_hooks
*/
static function deleteAccount($data)
{
if ($data['new_owner'])
{
// ToDo: copy content of user-dir to new owner's user-dir
}
// delete the user-directory
egw_vfs::$is_root = true;
if ($data['new_owner'] && ($new_lid = $GLOBALS['egw']->accounts->id2name($data['new_owner'])))
{
// copy content of user-dir to new owner's user-dir as old-home-$name
for ($i=''; file_exists(egw_vfs::PREFIX.($new_dir = '/home/'.$new_lid.'/old-home-'.$data['account_lid'].$i)); $i++);
egw_vfs::rename('/home/'.$data['account_lid'],$new_dir);
// make the new owner the owner of the dir and it's content
egw_vfs::find($new_dir,array(),array('egw_vfs','chown'),$data['new_owner']);
}
else
{
// delete the user-directory
egw_vfs::remove('/home/'.$data['account_lid']);
}
egw_vfs::$is_root = false;
}