mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
fixed missing shortname pg upgrade code, sorry
This commit is contained in:
parent
a6b02b652b
commit
45b9781ed4
@ -2224,7 +2224,7 @@ function main_upgrade($oldversion=0) {
|
||||
delete_records('config', 'name', 'requestedstudentsname');
|
||||
}
|
||||
|
||||
if ($oldversion < 2006091804) {
|
||||
if ($oldversion < 2006091901) {
|
||||
$roles = get_records('role');
|
||||
$first = array_shift($roles);
|
||||
if (!empty($first->shortname)) {
|
||||
@ -2248,6 +2248,7 @@ function main_upgrade($oldversion=0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -1824,6 +1824,31 @@ function main_upgrade($oldversion=0) {
|
||||
delete_records('config', 'name', 'requestedstudentsname');
|
||||
}
|
||||
|
||||
if ($oldversion < 2006091901) {
|
||||
$roles = get_records('role');
|
||||
$first = array_shift($roles);
|
||||
if (!empty($first->shortname)) {
|
||||
// shortnames already exist
|
||||
} else {
|
||||
table_column('role', '', 'shortname', 'varchar', '100', '', '', 'not null', 'name');
|
||||
$legacy_names = array('admin', 'coursecreator', 'editingteacher', 'teacher', 'student', 'guest');
|
||||
foreach ($legacy_names as $name) {
|
||||
if ($roles = get_roles_with_capability('moodle/legacy:'.$name, CAP_ALLOW)) {
|
||||
$i = '';
|
||||
foreach ($roles as $role) {
|
||||
if (empty($role->shortname)) {
|
||||
$updated = new object();
|
||||
$updated->id = $role->id;
|
||||
$updated->shortname = $name.$i;
|
||||
update_record('role', $updated);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
// This is compared against the values stored in the database to determine
|
||||
// whether upgrades should be performed (see lib/db/*.php)
|
||||
|
||||
$version = 2006091900; // YYYYMMDD = date
|
||||
$version = 2006091901; // YYYYMMDD = date
|
||||
// XY = increments within a single day
|
||||
|
||||
$release = '1.7 dev'; // Human-friendly version name
|
||||
|
Loading…
x
Reference in New Issue
Block a user