Author Topic: userbase management  (Read 3346 times)

Offline albunix

  • Jr. Member
  • **
  • Posts: 11
userbase management
« on: January 26, 2010, 03:07:17 PM »
Hello,

we've moved a big installation from Atmail Pearl version
to RoundCube latest.  So far so good.

However, here's a pressing issue which will be forced upon us down the road
eventually.

How to purge inactive users?  E.g we're a small hosting company and users come & go.  With such our DB grows steadily little by little, but eventually it'll need a good purge.

Atmail used to have a decent feature to purge inactive users by a given amount of time, and I wonder how to do such on RoundCube.

Please advise with ideas/directions

Thanks

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,850
userbase management
« Reply #1 on: January 26, 2010, 03:44:37 PM »
You could run an SQL query on a regular basis and delete based on the last_login field. Something like:
Code: [Select]
DELETE FROM users WHERE last_login < (CURDATE() - INTERVAL 3 MONTH);I haven't tested it but I think as long as you have all the constraints setup then once you delete a user it will cascade and delete all related data in the db.
« Last Edit: January 26, 2010, 03:50:37 PM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline albunix

  • Jr. Member
  • **
  • Posts: 11
userbase management
« Reply #2 on: February 01, 2010, 12:28:39 PM »
Hi,

thanks for the hint.

Hopefully something more accepted than running DB back end scripts will be officially be developed or agreed upon as the proper way to clean up stale users.

Something which would eventually consider all aspects of extracting a user and purging them, such as Address Book, any potential preferences linked to them etc.

Thanks

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
userbase management
« Reply #3 on: February 01, 2010, 12:49:25 PM »
Posted via Mobile Device
If all constraints in the database then all things related to the user will be wiped out.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline albunix

  • Jr. Member
  • **
  • Posts: 11
userbase management
« Reply #4 on: February 13, 2010, 11:54:05 AM »
Hi Rosali,

I did not understand you.

Did you imply that the query provided by JohnDoh is enough
to maintain a 'clean' DB in respect to stale users?

What about their address book etc, it seems that query does not affect
them, or does it?

Thanks

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
userbase management
« Reply #5 on: February 14, 2010, 04:30:18 AM »
MySQL InnoDB:

If the the database type is InnoDB and all constrainsts are linked to users.user_id then all items in all tables are deleted if you delete a user in users table.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)