Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-28253 use unique name for new manager role

  • Loading branch information...
commit badddcab368c9dad293e3414f846b1135e82c3c0 1 parent c015236
@skodak skodak authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/db/upgrade.php
View
6 lib/db/upgrade.php
@@ -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');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.