Adding defaultrole to course table
This commit is contained in:
@@ -1812,6 +1812,14 @@ function main_upgrade($oldversion=0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2006091700) {
|
||||
table_column('course','','defaultrole','int','10');
|
||||
if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
$studentrole = array_shift($studentroles); /// Take the first one
|
||||
execute_sql('UPDATE '.$CFG->prefix.'course SET defaultrole = '.$studentrole->id);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user