Should include the following 2 steps:

I. Configuration data migration:
- migration of server, profile data to ldap_user and ldap_servers
- warning of additional fields that need to be entered
- confirmation that settings are correct and display of sample actions from part II to confirm behaviour.

II. Update and populate missing user data:
- cron/batch process for updating all user entries, authmaps, etc and populating new fields

Comments

johnbarclay’s picture

Assigned: Unassigned » johnbarclay
johnbarclay’s picture

Status: Active » Needs review

I committed a patch for this to 7.x-2.x-dev. It needs testing and there is still manual configuration that needs to be done afterward, particularly related to ldap authorization and provisioning to drupal because of changes in ldap servers, ldap authorization, and the new ldap user module.

Please test. Here are my test scripts:

; initial mysql dump, run once
drush -y cc all
drush -y test-clean
drush -y watchdog-delete all
drush sql-dump --result-file=mysql_ldap71.sql

; test update
drush dl -y ldap-7.x-2.x-dev
drush -y updatedb


; restore to original state to test update again
drush dl -y ldap-7.x-1.x-dev
mysql -u root -pmypassword mydbname < mysql_ldap71.sql
drush -y cc all
yalet’s picture

I received the following output from drush after following your update instructions:

Do you wish to run all pending updates? (y/n): y
Performed update: ldap_servers_update_7102                                                                                                     [ok]
Performed update: ldap_servers_update_7103                                                                                                     [ok]
Performed update: ldap_servers_update_7104                                                                                                     [ok]
array_values() expects parameter 1 to be array, string given module.inc:388                                                                    [warning]
array_flip() expects parameter 1 to be array, null given module.inc:388                                                                        [warning]
Variable passed to each() is not an array or object module.inc:390                                                                             [warning]
Performed update: ldap_servers_update_7105                                                                                                     [ok]
Performed update: ldap_servers_update_7106                                                                                                     [ok]
Performed update: ldap_servers_update_7107                                                                                                     [ok]
Performed update: ldap_servers_update_7108                                                                                                     [ok]
Performed update: ldap_servers_update_7109                                                                                                     [ok]
Performed update: ldap_servers_update_7110                                                                                                     [ok]
Performed update: ldap_servers_update_7111                                                                                                     [ok]
Performed update: ldap_servers_update_7112                                                                                                     [ok]
Performed update: ldap_servers_update_7201                                                                                                     [ok]
Performed update: ldap_servers_update_7202                                                                                                     [ok]
Cannot rename field <em class="placeholder">ldap_servers</em>.<em class="placeholder">testingDrupalUserDn</em> to <em                          [error]
class="placeholder">testing_drupal_user_dn</em>: target field already exists.
Performed update: ldap_servers_update_7203                                                                                                     [ok]
Performed update: ldap_authentication_update_7100                                                                                              [ok]
Finished performing updates. 
johnbarclay’s picture

Thanks. The 2 issues were a bad format for enabling ldap_user module and failing to check for existing field. The fix is committed and is http://drupalcode.org/project/ldap.git/commitdiff/45b21f47c21193f76bd85d...

@yalet, you'll need to enable ldap_user module; it is leveraged by ldap_authentication, ldap_authorization and replaces ldap_provisioning.

yalet’s picture

I restored my database to pre-update, applied the patch for that commit, and re-ran drush updatedb. I received only one error this time (another field rename error):

Do you wish to run all pending updates? (y/n): y
Performed update: ldap_servers_update_7106                                                                            [ok]
Performed update: ldap_servers_update_7107                                                                            [ok]
Performed update: ldap_servers_update_7108                                                                            [ok]
Performed update: ldap_servers_update_7109                                                                            [ok]
Performed update: ldap_servers_update_7110                                                                            [ok]
Performed update: ldap_servers_update_7111                                                                            [ok]
Performed update: ldap_servers_update_7112                                                                            [ok]
Performed update: ldap_servers_update_7201                                                                            [ok]
Performed update: ldap_authorization_update_7201                                                                      [ok]
Performed update: ldap_servers_update_7202                                                                            [ok]
Performed update: ldap_authorization_update_7202                                                                      [ok]
Performed update: ldap_servers_update_7203                                                                            [ok]
Cannot rename field <em class="placeholder">ldap_authorization</em>.<em class="placeholder">useFirstAttrAsGroupId</em>[error]
to <em class="placeholder">use_first_attr_as_groupid</em>: target field already exists.
Performed update: ldap_authorization_update_7203                                                                      [ok]
Finished performing updates.
johnbarclay’s picture

Thanks for following through on this. I committed a patch to fix this as well as the other remaining db field change function that doesn't check for field's existence. See http://drupalcode.org/project/ldap.git/commitdiff/5738743677c576a2a7f189...

yalet’s picture

I reverted my database and my code back to pre-upgrade. Then I downloaded the 7.x-2.0beta3, and applied both patches from this thread, and reran drush updatedb. Everything passed this time.

(I'm not sure if the patches were meant to be applied against 7.x-2.0beta3 or 7.x-2.x-dev, but I thought it would be useful to try out anyway, so here's a data point if it is at all relevant).

Actually, now that I read the Version field for this issue I see it was specifically about 7.x-2.x-dev, but whatever, worked anyway.

johnbarclay’s picture

great. thanks.

humansky’s picture

I'm attempting to upgrade from 7.x-1.0-beta12 to 7.x-2.x-dev and when I run drush updb I get the following error:

Do you wish to run all pending updates? (y/n): y
Performed update: ldap_servers_update_7106 [ok]
Performed update: ldap_servers_update_7107 [ok]
Performed update: ldap_servers_update_7108 [ok]
Performed update: ldap_servers_update_7109 [ok]
Performed update: ldap_servers_update_7110 [ok]
Performed update: ldap_servers_update_7111 [ok]
Performed update: ldap_servers_update_7112 [ok]
strtr(): The second argument is not an array syslog.module:115 [warning]
Performed update: ldap_servers_update_7201 [ok]
Performed update: ldap_servers_update_7202 [ok]
Performed update: ldap_authorization_update_7201 [ok]
Performed update: ldap_servers_update_7203 [ok]
Performed update: ldap_authorization_update_7202 [ok]
Cannot add field ldap_servers.picture_attr: field [error]
already exists.
Performed update: ldap_servers_update_7204 [ok]
Performed update: ldap_authorization_update_7203 [ok]
Performed update: ldap_query_update_7102 [ok]
Finished performing updates. [ok]

Then I tried again, dropped the database, re-imported the old database, then ran drush updb, now I get a different error:

Do you wish to run all pending updates? (y/n): y
Performed update: ldap_servers_update_7106 [ok]
Performed update: ldap_servers_update_7107 [ok]
Performed update: ldap_servers_update_7108 [ok]
Performed update: ldap_servers_update_7109 [ok]
Performed update: ldap_servers_update_7110 [ok]
Performed update: ldap_servers_update_7111 [ok]
Performed update: ldap_servers_update_7112 [ok]
strtr(): The second argument is not an array syslog.module:115 [warning]
Performed update: ldap_servers_update_7201 [ok]
Performed update: ldap_authorization_update_7201 [ok]
Performed update: ldap_servers_update_7202 [ok]
Performed update: ldap_authorization_update_7202 [ok]
Cannot rename field ldap_servers.testingDrupalUserDn to class="placeholder">testing_drupal_user_dn: target field already exists.
Performed update: ldap_servers_update_7203 [ok]
Cannot rename field ldap_authorization.useFirstAttrAsGroupId to class="placeholder">use_first_attr_as_groupid: target field already exists.
Performed update: ldap_authorization_update_7203 [ok]
Performed update: ldap_query_update_7102 [ok]
Finished performing updates. [ok]

Any thoughts?

mikran’s picture

Status: Needs review » Needs work

I got same error as #9, ldap_servers.picture_attr already exists. I tried to repeat this twice and the result did not change. I didn't have ldap_authorization enabled, so maybe that and changing order how these updates are ran explains the difference in errors?

yalet’s picture

Status: Needs work » Needs review
StatusFileSize
new801 bytes

This patch should solve the Cannot add field ldap_servers.picture_attr: field already exists. error.

johnbarclay’s picture

#11 is committed. Thanks.

yalet’s picture

I don't see the commit. Is it somewhere other than 7.x-2.x?

Caveat4U’s picture

Could you please commit this patch to the most recent version of ldap? It doesn't look as though this actually got committed.
Thanks!

johnbarclay’s picture

I applied #11 and pushed it out.

byrond’s picture

StatusFileSize
new858 bytes

This patch should solve the Cannot add field ldap_servers.followrefs: field already exists. error.

  • johnbarclay committed 45b21f4 on 8.x-3.x authored by yalet
    Issue #1740152 by yalet.  Update issues for ldap_serves
    
  • johnbarclay committed 5738743 on 8.x-3.x authored by yalet
    Issue #1740152-8 by yalet.  Fix for update hook for ldap authorization...
grahl’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Since the current recommendation is to keep 1.x sites on that version, I'm closing this.