New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the method for user deletion #408
Conversation
Improves the method for use deletion.
GitHub for Windows shows me a CONFLICT with file ./inc/modules/user/users.php regarding some buddy code in that file... |
What you mean by buddy code? |
I'm not sure @PirataNervo, that is the error message GitHub for Windows shows me. We will need to manually merge this (which I don't know how-to) or create a new PR for this. |
You should probably just fix the users.php file then. Pick a fresh and do the edits manually there again - it should be fixed after that. (you'll likely need to create a new PR) |
Is there any reason the datahandler has a multiple uid input? |
Some parts delete multiple users at the same run. Should it only accept one UID and be run for every user being deleted? That could be resource intensive. I will have a look at the conflict. |
I think it might be easier, especially for plugin authors. The original function also only ran one-per-user. |
The origianl function for deleting one use did, however there some places within the 1.6 code that deletes multiple users at once (prune users, for example). I can see your way being more friendly to the data-handler and I agree with you, but I did it this way to avoid possible extensive use of resources or similar. @PirataNervo, @stefan-st any comments? |
Check if the input is an array. If it's not an array, assume it's one uid and put it into an array. If it's an array, then you assume you have multiple uid's. |
I think that is what it already does: $this->delete_uids = array_map('intval', (array)$delete_uids); The following are valid uses of the new method: $data_handler->delete_user( integer $uid);
$data_handler->delete_user( array $uids);
$data_handler->delete_user( integer $uid, boolean $prune_content);
$data_handler->delete_user( array $uids, boolean $prune_content); |
(I had not checked to be honest, just provided my input based on the comments) |
I assumed you didn't checked, didn't intend to be rude! 👅 |
Just fix the conflict problem and we're good to go :P |
Improve the method for user deletion
Thanks Jordan! |
Please be clear with any issues.