Show warning if home dirs being deleted contain other files

This commit is contained in:
Jamie Cameron
2012-06-04 20:56:48 +08:00
parent ed0f445d68
commit af3b831f8d
2 changed files with 9 additions and 2 deletions

View File

@@ -478,6 +478,7 @@ pft_6=MacOS NetInfo database
umass_title=Delete Users
umass_err=Failed to delete users
umass_sure=Are you sure you want to delete the $1 selected users? Their home directories contain $2 of files.
umass_others=WARNING! Some home directories contain $1 files owned by other users.
umass_sure2=Are you sure you want to delete the $1 selected users?
umass_euser=You are not allowed to delete the user $1
umass_enone=No users selected

View File

@@ -228,6 +228,10 @@ else {
foreach $user (@dlist) {
if ($user->{'home'} ne "/" && -d $user->{'home'}) {
$size += &disk_usage_kb($user->{'home'});
@uothers = &backquote_command(
"find ".quotemeta($user->{'home'}).
" ! -user $user->{'uid'} 2>/dev/null", 1);
push(@others, @uothers);
}
}
@@ -256,8 +260,10 @@ else {
$access{'dothers'} == 1 ?
&ui_checkbox("others", 1, $text{'udel_dothers'},
$config{'default_other'}) : "",
$delete_sys && $delete_sys->{'user'} eq 'root' ?
$text{'udel_root'} : "",
(@others ? &text('umass_others', scalar(@others))."<p>"
: "").
($delete_sys && $delete_sys->{'user'} eq 'root' ?
$text{'udel_root'} : ""),
);