[cvs] [Wiki] changed: MigrateIdentities

Jan Schneider jan at horde.org
Tue Jan 9 04:54:35 PST 2007


jan  Tue, 09 Jan 2007 04:54:34 -0800

Modified page: http://wiki.horde.org/MigrateIdentities
New Revision:  1.2
Change log:  Fix table name

@@ -12,10 +12,10 @@
          CONCAT('a:1:{i:0;a:5:{s:2:"id";s:16:"Default Identity";s:8:"fullname";s:',
                 LENGTH(IFNULL(fullname, '')), ':"', IFNULL(fullname, ''),
                 '";s:9:"from_addr";s:', LENGTH(IFNULL(replyto, '')), ':"', IFNULL(replyto, ''),
                 '";s:16:"default_identity";s:1:"0";s:9:"signature";s:', LENGTH(IFNULL(sig, '')), ':"', IFNULL(sig, ''), '";}}')
-         FROM imp_pref WHERE user LIKE '%@localhost' OR user LIKE '%@example.com';
+        FROM imp_pref WHERE user LIKE '%@localhost' OR user LIKE '%@example.com';
  </code>
  
-This code takes all entries from the {{horde_prefs}} table that have the user name ending with {{@localhost}} or {{@example.com}}. This domain part is then stripped from the user name ({{SUBSTRING(...)}}) and a string representing a serialized PHP array is build ({{CONCAT(...)}}) from the {{fullname}}, {{replyto}}, and {{sig}} columns. The {{IFNULL(...)}} expressions make sure that this works with both, empty and NULL values in the table fields.
+This code takes all entries from the {{imp_pref}} table that have the user name ending with {{@localhost}} or {{@example.com}}. This domain part is then stripped from the user name ({{SUBSTRING(...)}}) and a string representing a serialized PHP array is build ({{CONCAT(...)}}) from the {{fullname}}, {{replyto}}, and {{sig}} columns and inserted into the {{horde_prefs}} table. The {{IFNULL(...)}} expressions make sure that this works with both, empty and NULL values in the table fields.
  
  Please note that this script only makes sense for //one-time// migration of existing data. If you have this kind of user data in an external source permanently, e.g. in a company addressbook, LDAP directory or similar, you should use preference hooks to create the user identities instead.


More information about the cvs mailing list