From 2b15a08dc99d88ae0dab3c7db3789a617f0876f4 Mon Sep 17 00:00:00 2001 From: vyshane Date: Thu, 21 Sep 2006 07:40:24 +0000 Subject: [PATCH] Added some notes for future reference --- mod/forum/lib.php | 9 ++++++--- mod/forum/restorelib.php | 8 +++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 12c87dfd54..8759e3001f 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -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)) { diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php index 90574083fa..5340cb3496 100644 --- a/mod/forum/restorelib.php +++ b/mod/forum/restorelib.php @@ -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)) { -- 2.39.5