Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: dimago on August 11, 2011, 06:02:09 PM

Title: delete user in the roundcube table after delete from postfixadmin
Post by: dimago on August 11, 2011, 06:02:09 PM
Hello All,

I was thinking about to delete the user database after delete user from postfixadmin.

So, I create users by postfixadmin. Its works fine. The user is inserted in the mail database. When I logging in the webmail, the user and others informations is inserted in the webmail database, right?

So, when I remove a user from postfixadmin, its removed from mail database, but in the webmail database doesn´t. I understand that, but I would like that the user will be deleted from the webmail database too.

Can anyone knows how can I do this?

Thanks,

Diego
Title: delete user in the roundcube table after delete from postfixadmin
Post by: JohnDoh on August 12, 2011, 05:25:47 AM
one way would be to run a cron job every night and delete anything in the rc users table which doesnt exist in the postfix one. as long as the rc tables are linked properly the delete will cascade and delete all the user's stuff from the other tables automatically.
Title: delete user in the roundcube table after delete from postfixadmin
Post by: dimago on August 12, 2011, 05:28:40 PM
Hi John,

Thanks again for you help.

So, let me see if I understood.

OK, I know what users I want to delete.

I make a script to delete the user diego in the USERS RC tables, like this: delete from USERS where USERNAME='diego'; ?

So, the rest of info about the user, in anothers RC tables will be deleted automatically?

Thanks,

Diego
Title: delete user in the roundcube table after delete from postfixadmin
Post by: JohnDoh on August 13, 2011, 04:12:38 AM
thats the idea, though I think it might depend on your particular implementation. take a look at the rc sql file mysql.initial.sql in trunk/roundcubemail/SQL (http://trac.roundcube.net/browser/trunk/roundcubemail/SQL/mysql.initial.sql) see all the "ON DELETE CASCADE" bits? thats what does it.
Title: delete user in the roundcube table after delete from postfixadmin
Post by: oldschool on August 13, 2011, 12:04:38 PM
Nice thread!

The ideas and infos help a lot...



Rgds.
Title: delete user in the roundcube table after delete from postfixadmin
Post by: dimago on August 13, 2011, 04:00:58 PM
hey John,

Here my feedback.

It´s works.

I did:

delete from users where username='[email protected]';

and all of infos in the tables are deleted.

I will make a script to do this auto to me.

Thanks again.

Diego