Mnet: Permit 1.8 upgrade to continue, even if duplicate usernames exist in the user table. # MDL-8720

This commit is contained in:
donal72 2007-03-05 07:49:38 +00:00
parent 453db436a7
commit 68879a5802
2 changed files with 9 additions and 1 deletions

View 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.';

View 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);