]> git.mjollnir.org Git - moodle.git/commitdiff
Mnet: Permit 1.8 upgrade to continue, even if duplicate usernames exist in the user...
authordonal72 <donal72>
Mon, 5 Mar 2007 07:49:38 +0000 (07:49 +0000)
committerdonal72 <donal72>
Mon, 5 Mar 2007 07:49:38 +0000 (07:49 +0000)
lang/en_utf8/mnet.php
lib/db/upgrade.php

index a1c54eb82c9c81a9028e0fff23566246933bbefe..2f1f89ee10774824591a4108fc8c9eb28ca421f5 100644 (file)
@@ -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]<br />';
 
+$string['duplicate_usernames']          = 'We failed to create an index on the columns \"mnethostid\" and \"username\" in your user table.<br />'.
+                                          'This can occur when you have <a href=\"$a\" target=\"_blank\">duplicate usernames in your user table</a>.<br />'.
+                                          '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.<br />';
+
 $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.';
index 992219e0b38b570d5b06379fa9f435c876d502dd..f7b70d1ff36ae45fc64d71eb9383a7925d94792c 100644 (file)
@@ -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);