]> git.mjollnir.org Git - moodle.git/commitdiff
Upgrade now works. Needs more testing.
authorvyshane <vyshane>
Tue, 22 Aug 2006 05:45:43 +0000 (05:45 +0000)
committervyshane <vyshane>
Tue, 22 Aug 2006 05:45:43 +0000 (05:45 +0000)
mod/forum/db/mysql.php
mod/forum/index.php
mod/forum/lib.php

index 97db13f99bfd9c98fcb175a7a9490a2eb6a3c67a..93661af5467fb6851c3eaf55336754fc8a5fdac8 100644 (file)
@@ -264,15 +264,17 @@ function forum_upgrade($oldversion) {
                       $mod->visible = 0;
                       $mod->visibleold = 0;
                       $mod->groupmode = 0;
-                  
-                      print_object($mod);
-                  
+                      
                       if (!$cmid = add_course_module($mod)) {
                           error('Could not create new course module instance for the teacher forum');
                       } else {
                           $mod->coursemodule = $cmid;
-                          if (!add_mod_to_section($mod)) {
-                              error('Could not add new forum instance to section 0 in the course');
+                          if (!$sectionid = add_mod_to_section($mod)) {
+                              error('Could not add converted teacher forum instance to section 0 in the course');
+                          } else {
+                              if (!set_field('course_modules', 'section', $sectionid, 'id', $cmid)) {
+                                  error('Could not update course module with section id');
+                              }
                           }
                       }
               
@@ -357,9 +359,6 @@ function forum_upgrade($oldversion) {
                           }
                           break;
                   }
-                  // Drop column forum.open.
-                  modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN open;');
-                  
                   
                   // $forum->assessed defines whether forum rating is turned
                   // on (1 or 2) and who can rate posts:
@@ -378,7 +377,6 @@ function forum_upgrade($oldversion) {
                           break;
                   }
                   
-                  
                   // $forum->assesspublic defines whether students can see
                   // everybody's ratings:
                   //   0 = Students can only see their own ratings
@@ -391,10 +389,19 @@ function forum_upgrade($oldversion) {
                           assign_capability('mod/forum:viewanyrating', CAP_ALLOW, $studentrole->id, $context->id);
                           break;
                   }
-                  // Drop column forum.assesspublic.
-                  modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN assesspublic;');
               }
-          } // End foreach $teacherforums.
+          } // End foreach $forums.
+          
+          // Drop column forum.open.
+          modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN open;');
+          
+          // Drop column forum.assesspublic.
+          modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN assesspublic;');
+          
+          // We need to rebuild all the course caches to refresh the state of
+          // the forum modules.
+          rebuild_course_cache();
+          
       } // End if.
   }
   
index 77d4b2402aba573a020e1ebed7cc3f4e8f99e424..39c12e90e885c2ccddea8b9b070371def28e0ab7 100644 (file)
@@ -78,7 +78,7 @@
 
     $generalforums = array();            // For now
     $learningforums = get_all_instances_in_course("forum", $course);
-
+    
     if ($forums = get_records("forum", "course", $id, "name ASC")) {  // All known forums
 
         if ($learningforums) {           // Copy "full" data into this complete array
index 087bb68c3c42515a9126c3d3c28b48155e80d966..dc791f6c18107945fba6d84274e61957e452abc7 100644 (file)
@@ -1595,12 +1595,6 @@ function forum_get_course_forum($courseid, $type) {
             $forum->assessed = 0;
             $forum->forcesubscribe = 0;
             break;
-        case "teacher":
-            $forum->name  = addslashes(get_string("nameteacher", "forum"));
-            $forum->intro = addslashes(get_string("introteacher", "forum"));
-            $forum->assessed = 0;
-            $forum->forcesubscribe = 0;
-            break;
         default:
             notify("That forum type doesn't exist!");
             return false;