Permalink
Browse files

MDL-28253 use unique name for new manager role

  • Loading branch information...
1 parent 93d82f4 commit 1024510a4ac5607bc577838e79db7d678ee74190 @skodak skodak committed Jul 14, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/db/upgrade.php
View
@@ -2858,16 +2858,16 @@ function xmldb_main_upgrade($oldversion) {
unset($role->capability);
if ($role->archetype === 'admin') {
$i = '';
- if ($DB->record_exists('role', array('shortname'=>'manager'))) {
+ if ($DB->record_exists('role', array('shortname'=>'manager')) or $DB->record_exists('role', array('name'=>get_string('manager', 'role')))) {
$i = 2;
- while($DB->record_exists('role', array('shortname'=>'manager'.$i))) {
+ while($DB->record_exists('role', array('shortname'=>'manager'.$i)) or $DB->record_exists('role', array('name'=>get_string('manager', 'role').$i))) {
$i++;
}
}
$role->archetype = 'manager';
if ($role->shortname === 'admin') {
$role->shortname = 'manager'.$i;
- $role->name = get_string('manager', 'role');
+ $role->name = get_string('manager', 'role').$i;
$role->description = get_string('managerdescription', 'role');
}
}

0 comments on commit 1024510

Please sign in to comment.