Needs work
Project:
Delete all
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Feb 2012 at 15:38 UTC
Updated:
28 Apr 2016 at 14:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
MrMaksimize commentedAttaching first run at a patch here. Wasn't sure what was going on with the sql statements, but it works fine for me without those.
Comment #2
coderintherye commentedThis is a good effort and works fairly well, but in order for this to be ready to go in, could you
1) Add some info to the delete_all_drush_command which will tell us that we can also do a delete-all users in addition to content types.
2) Can you test what happens if you do drush delete-all users when you have a content type called "users"? Seems like this could conflict
3) Try to make your patches so they ignore whitespace changes, there were a bunch of empty line changes in the patch, might be because you had tabs set? Use 2 spaces and no tabs.
Thanks!
Also, when you post your new patch, change the status to "Needs Review"
Comment #3
MrMaksimize commentedFor sure!! Thanks for the tips!! (/me still new at making good patches). I'll spin up a brand new d7 site in the next day or 2 and make sure to get everything up to par :)
As for the tabs, you're right I think it might've been my ide ;(
Comment #4
coderintherye commentedHere's an updated patch. If someone wants to review it I can commit it. I'd like to see the ability to delete by role as well...
Comment #5
MrMaksimize commented@coderintherye sorry man got sick that weekend and then completely forgot. I just tested the patch on a clean d7 site with a bunch of nodes in content-type called users and also a bunch of actual users and it works great!! Sorry for the slack :(
Comment #6
coderintherye commentedNo problem. I'll go ahead and commit this in then and attribute it to you. Thanks!
Comment #7
MrMaksimize commentedCool.. Let me know when u do :) I started working off your patch - almost ready with the roles :)
Comment #8
MrMaksimize commentedOkely doke one more run - building on the patch above to also pick roles... Learning some cool stuff about drush in this issue :)
Comment #9
MrMaksimize commentedSetting back to needs review
Comment #10
coderintherye commentedCool thanks! I'll try applying it later and see what happens.
Comment #11
alibama commentedthis seems very useful - any chance of a backport?
Comment #12
coderintherye commentedSorry this took a long time to review.
Setting back to needs work because when I tried:
drush delete-all users --roles
and then selected admin, it deleted user 1.
I think we should follow the same behavior as drush delete-all users which is to *not* delete user 1.
Ideally, this could also work as drush delete-all users --roles=admin
Also, if possible, I'd love to have some help documentation in here, but that could be in a separate ticket.
Comment #13
coderintherye commented@ #11 I won't be doing any backports to 6.x sorry, solely working on 7.x cause that is all I have time for. Though once this ticket is resolved feel free to change to 6.x. and see if a 6.x. maintainer will backport it.
Comment #14
MrMaksimize commentedOhh agreed. Will reroll :)
Comment #15
coderintherye commentedOk, this should be ready to go in the latest dev snapshot when it comes up, as I've just committed.
Now you can do
drush delete-users [role]
example: drush delete-users administrator
or you can pass a number of roles as comma-separated values
example: drush delete-users administrator,editors
Caveat: Can't delete users who are only "authenticated users" except to delete all users (as they technically don't have a role), though we can tackle that in another issue if someone has a need for it.
Comment #17
zuernbernhard commentedHm 3 years later:
$ drush delete-users
results ins:
The drush command 'delete-users' could not be found. Run `drush cache-clear drush` to clear the commandfile cache if you have installed new extensions.
Comment #18
zuernbernhard commentedComment #19
zuernbernhard commentedsry, my fault works as designed
Comment #20
poniesInstalled the latest dev commit, 2013-Sep-30.
Tried running
drush da --roles usersand always received the 'Deleted 0 users'.The delete_all_users_delete function was being passed an integer, the rid, from delete_all_drush_delete. On line delete_all.module:516 it uses the rid as the role name to try to find the rid.
It's more efficient for delete_all_users_delete to accept rids than to pass it the role name and have it preform another database query. I don't see anywhere in the code where it's passing roles to delete_all_users_delete, but having it accept rids and role names might bork if a role name is an integer.
Because user_roles() is going to be called to populate the form, I propose that delete_all_users_delete only accept rids.