MojoMojo

 view release on metacpan or  search on metacpan

script/util/delete_inactive_users.pl  view on Meta::CPAN

        $users->delete;
    } elsif (uc $answer eq 'I') {
        # delete the fuckers individually
        while (my $user = $users->next) {
            my @user_pages = $user->pages;
            print "User ", $user->name, "has been disabled, and they edited ", scalar @user_pages, " pages:\n";
            print map {'    ' . $_->path . "\n" } @user_pages;
            print "Delete this user? ('yes'/anything else) ";
            my $answer = <STDIN>; chomp $answer;
            if ($answer eq 'yes') {
                # this nicely cascades to delete the revisions authored by the user in Content, 
                # and the Page and PageVersion if they are left without any Content revision
                $user->delete;  
                $users_deleted++;
            }
        }
    }
}    

# Unconfirmed users (active = -1) who have edited pages are left alone. This can only mean that the user was
# once active, but then changed their e-mail address and hasn't confirmed the new one.



( run in 1.125 second using v1.01-cache-2.11-cpan-49f99fa48dc )