From: donal72 Date: Mon, 5 Mar 2007 07:49:38 +0000 (+0000) Subject: Mnet: Permit 1.8 upgrade to continue, even if duplicate usernames exist in the user... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=68879a58021196a1b46a92f61f78ea0bf4121c8c;p=moodle.git Mnet: Permit 1.8 upgrade to continue, even if duplicate usernames exist in the user table. # MDL-8720 --- diff --git a/lang/en_utf8/mnet.php b/lang/en_utf8/mnet.php index a1c54eb82c..2f1f89ee10 100644 --- a/lang/en_utf8/mnet.php +++ b/lang/en_utf8/mnet.php @@ -37,6 +37,11 @@ $string['showlocal'] = 'Show local users'; $string['hostcoursenotfound'] = 'Host or course not found'; $string['enrollingincourse'] = 'Enrolling in course $a[0] on host $a[1]
'; +$string['duplicate_usernames'] = 'We failed to create an index on the columns \"mnethostid\" and \"username\" in your user table.
'. + 'This can occur when you have duplicate usernames in your user table.
'. + 'Your upgrade should still complete successfully. Click on the link above, and instructions on fixing'. + ' this problem will appear in a new window. You can attend to that at the end of the upgrade.
'; + $string['nomodifyacl'] = 'You are not permitted to modify the MNET access control list.'; $string['recordnoexists'] = 'Record does not exist.'; $string['enterausername'] = 'Please enter a username, or a list of usernames separated by commas.'; diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 992219e0b3..f7b70d1ff3 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -339,7 +339,10 @@ function xmldb_main_upgrade($oldversion=0) { $index->setFields(array('username')); drop_index($table, $index); $index->setFields(array('mnethostid', 'username')); - $result = $result && add_index($table, $index); + $empty_on_duplicate = add_index($table, $index); + if(empty($fail_on_duplicate)) { + notify(get_string('duplicate_usernames', 'mnet', 'http://docs.moodle.org/en/DuplicateUsernames')); + } unset($table, $field, $index);