Roundcube Community Forum

 

bin/deluser.sh help

Started by ramgs, January 09, 2016, 09:16:57 PM

Previous topic - Next topic

ramgs

Hello.

Can the bin/deluser.sh script be used to remove entries in the Roundcube database based on user_id or email_address? Or is the argument to this command limited to the username alone?

I found recently that old user entries from a test version are still hanging around. I thought I had removed them, but actually had not. In the live system, the IP address and hostname changed, so the test users got a new user_id. How may I cleanly remove the old entries?

Thanks.

SKaero


Usage: deluser.sh [--host=mail_host] username
--host=HOST  The IMAP hostname or IP the given user is related to

ramgs

Thanks for your reply, SKaero.

I've used deluser.sh before in its simplest form, so I'm aware that the syntax says 'username'. Are you suggesting that I try the host option, since that had changed between the test and live system in my case?

General Qs:

This is the searching line in the php script (I know some php but not enough to deal with databases)
// find user in loca database
$user = rcube_user::query($username, $args['host']);

The "rcube_user" must mean username, but I was wondering if it picks anything that might be a part of that particular entry.

At the end, this script finds the user_id associated with username. It might be convenient to allow deletion based on user_id, since it is unique across the database, even if the username is repeated for some reason. It seems this would be a small change in this deluser.sh script.

Thanks.

SKaero

I was suggesting using the host option since that is an identifier for the user that your trying to delete.

"rcube_user" is referring the rcube_user class which can be found in <RC root>/program/lib/Roundcube/rcube_user.php the query function only looks at the username and host fields.

I don't think its a bad idea to be able to delete based on user id, I can defiantly see use cases for it, you could create a feature request for it on the bug tracker: http://trac.roundcube.net/

ramgs

Thank you! It worked like a charm.