Added some notes for future reference
This commit is contained in:
+6
-3
@@ -4467,9 +4467,12 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(),
|
||||
}
|
||||
|
||||
if ($forum->type == 'teacher') {
|
||||
|
||||
|
||||
// Teacher forums should be converted to normal forums that
|
||||
// use the Roles System to implement the old behavior.
|
||||
// Note:
|
||||
// Seems that teacher forums were never backed up in 1.6 since they
|
||||
// didn't have an entry in the course_modules table.
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
|
||||
if (count_records('forum_discussions', 'forum', $forum->id) == 0) {
|
||||
@@ -4483,8 +4486,8 @@ function forum_convert_to_roles($forum, $forummodid, $teacherroles=array(),
|
||||
$mod->module = $forummodid;
|
||||
$mod->instance = $forum->id;
|
||||
$mod->section = 0;
|
||||
$mod->visible = 0;
|
||||
$mod->visibleold = 0;
|
||||
$mod->visible = 0; // Hide the forum
|
||||
$mod->visibleold = 0; // Hide the forum
|
||||
$mod->groupmode = 0;
|
||||
|
||||
if (!$cmid = add_course_module($mod)) {
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
$forum->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
|
||||
$forum->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
|
||||
|
||||
|
||||
// These get dropped in Moodle 1.7 when the new Roles System gets
|
||||
// set up. Therefore they might or not be there depending on whether
|
||||
// we are restoring a 1.6+ forum or a 1.7 or later forum backup.
|
||||
@@ -166,13 +165,12 @@
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
|
||||
|
||||
// If the backup contained $forum->open and $forum->assesspublic,
|
||||
// we need to convert the forum to use Roles. It means the backup
|
||||
// was made pre Moodle 1.7. We check the backup_version to make
|
||||
// sure.
|
||||
// was made pre Moodle 1.7.
|
||||
if (isset($forum->open) && isset($forum->assesspublic)) {
|
||||
|
||||
|
||||
$forummod = get_record('modules', 'name', 'forum');
|
||||
|
||||
if (!$teacherroles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {
|
||||
|
||||
Reference in New Issue
Block a user