Roundcube Community Forum

Release Support => Release Discussion => Topic started by: CarlosinFL on July 06, 2009, 03:57:50 PM

Title: MySQL - What Tables Are Modified For New Users?
Post by: CarlosinFL on July 06, 2009, 03:57:50 PM
I am running MySQL 5 and Roundcube and would like to know when a user logs into Roundcube for the 1st time, what table entries are modified / touched / created in the database?

I have Roundcube configured to create the user data in the database when you login for the 1st time however I don't know what is created for a new user. This helps me know what needs to be deleted when that user is gone. If I delete that user from my Linux system, I don't want their Roundcube MySQL database data to clutter up after they're deleted from the system.

Can someone please help me?
Title: MySQL - What Tables of Modified For New Users?
Post by: JohnDoh on July 07, 2009, 03:23:42 AM
There will be an entry in the Users table and the Identities table, then once they start using the system they could have multiple entries in the Identities table, the Contacts table and if you have caching enabled then in the cache and messages tables too.
Title: MySQL - What Tables of Modified For New Users?
Post by: CarlosinFL on July 07, 2009, 10:03:53 AM
Thanks. Is there an simple solution I can use or how do other RC admins manage when someone leaves and their Linux shell account is removed. I don't want their accounts to linger with useless data in MySQL. Is there a simple solution to cleaning up MySQL once I remove a user from my mail server?
Title: MySQL - What Tables of Modified For New Users?
Post by: maka on July 07, 2009, 04:26:04 PM
Hi there!

I have made a couple of bash-scripts to solve this nicely on my domain. Note that you need to know the RC user id of the user you need to remove (I usually map the RC user id to the linux uid when I create a RC user for convenience).

Run the following 5 SQL commands on your RC DB to remove a user:
DELETE FROM messages WHERE messages.user_id = ;
DELETE FROM cache WHERE cache.user_id = ;
DELETE FROM contacts WHERE contacts.user_id = ;
DELETE FROM identities WHERE identities.user_id = ;
DELETE FROM users WHERE users.user_id = LIMIT 1;

If the RC user id of your user is 6 then replace above with 6.

Please also note that users table must be the last one where you remove the user.

Hope this helps a bit.

~# Magnus