Author Topic: loading mysql tables  (Read 6488 times)

Offline egbert

  • Newbie
  • *
  • Posts: 4
loading mysql tables
« on: May 15, 2010, 05:06:14 PM »
Hi, new here but a longtime user of Roundcube. My question:

I would like to fill (prime if you like) the user table with about 2000 users with an external script. Because the tables are cleverly linked together with  a foreign key, I can not do that easily. I'm used to load the postfixadmin tables with the list of allowed users and I want to do the same with the user table of RC. Unnessessary to say that $rcmail_config['auto_create_user'] = False;
Maybe it is more a MySQL question, but somebody here might know...

TIA
Egbert Jan (NL)

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,855
loading mysql tables
« Reply #1 on: May 16, 2010, 04:02:00 AM »
there is nothing to worry about with the foreign keys, everything links back to the users table there is nothing going the other way and the id auto increments so that will take care of itself. the only tricky buy could be the mail_host field, this must match the host being used during the login, if it doesnt a new account will be created.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline egbert

  • Newbie
  • *
  • Posts: 4
loading mysql tables
« Reply #2 on: May 16, 2010, 06:53:50 AM »
TNX. The auto increment thinggy IS my problem. The idea is that I do a monthly reload of the (at least) users and dentities table. Since the existing mails are also linked to the user-id, I want to use a fixed (but unique) user-id for each user. mysql doesn't chew that with the current db structure. Maybe I should remove the foreign keys first and add them again?

Therre will never be auto-added users. Our users are not smart enough to enter their identities so we want to do that for them.

Is there a module plug in to achieve the same? Just feed it the data? As I said before, creating a loader file is not the problem. Now I tried .sql (export/import format) but I probably can create whatever is needed.

Egbert Jan

Offline egbert

  • Newbie
  • *
  • Posts: 4
loading mysql tables
« Reply #3 on: May 16, 2010, 07:36:26 AM »
Just found the 'new_user_identity' plugin. I have no understanding of how to write a plugin but I have the feeling that this comes very close to what I actually need. I could revert back to the auto-user-create with its auto increment user_id which works fine together with postfix/dovecot but then the plug in should update the identity for this user on (first) login. The data must come from mysql; not ldap, in my case. I could use some help writing such a plugin... Never done such a thing.

Egbert Jan

Offline ABerglund

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 673
loading mysql tables
« Reply #4 on: May 16, 2010, 06:33:28 PM »
I use both new_user_identity and virtuser_file on my system and let the user accounts auto-create.
« Last Edit: May 17, 2010, 11:03:37 AM by ABerglund »
Arne Berglund
SysAdmin, Internet Services
Lane Education Service District
Eugene, OR, USA

Offline egbert

  • Newbie
  • *
  • Posts: 4
loading mysql tables
« Reply #5 on: May 17, 2010, 07:06:26 AM »
Solved my problem with virtuser_query. The email adres is taken from the postfixadmin.alias table. Auto-register is on again.
Tnx all for suggestions.
Egbert Jan

Offline oldschool

  • Sr. Member
  • ****
  • Posts: 406
loading mysql tables
« Reply #6 on: June 21, 2010, 11:46:20 AM »
In my case the postfix/virtual does it!

Love RC from day to day more and more...
;)


Rgds.