]> git.mjollnir.org Git - moodle.git/commitdiff
I suppose that now forum needs current version of Moodle
authorstronk7 <stronk7>
Sun, 2 May 2004 23:14:53 +0000 (23:14 +0000)
committerstronk7 <stronk7>
Sun, 2 May 2004 23:14:53 +0000 (23:14 +0000)
to work (modified cron system...), isn't it?

mod/forum/restorelib.php
mod/forum/version.php

index e530408f5d3a36c5c426b5a1ea2fe63f50758526..922e2716da7fad8eb431f837be9e906f473f273c 100644 (file)
 
         $searchstring='/\$@(FORUMVIEWBYID)\*([0-9]+)@\$/';
         //We look for it
-        preg_match_all($searchstring,$content,$foundset);
+        preg_match_all($searchstring,$result,$foundset);
         //If found, then we are going to look for its new id (in backup tables)
         if ($foundset[0]) {
             //print_object($foundset);                                     //Debug
 
         $searchstring='/\$@(FORUMVIEWBYF)\*([0-9]+)@\$/';
         //We look for it
-        preg_match_all($searchstring,$content,$foundset);
+        preg_match_all($searchstring,$result,$foundset);
         //If found, then we are going to look for its new id (in backup tables)
         if ($foundset[0]) {
             //print_object($foundset);                                     //Debug
 
         $searchstring='/\$@(FORUMDISCUSSIONVIEW)\*([0-9]+)@\$/';
         //We look for it
-        preg_match_all($searchstring,$content,$foundset);
+        preg_match_all($searchstring,$result,$foundset);
         //If found, then we are going to look for its new id (in backup tables)
         if ($foundset[0]) {
             //print_object($foundset);                                     //Debug
 
         $searchstring='/\$@(FORUMDISCUSSIONVIEWPARENT)\*([0-9]+)\*([0-9]+)@\$/';
         //We look for it
-        preg_match_all($searchstring,$content,$foundset);
+        preg_match_all($searchstring,$result,$foundset);
         //If found, then we are going to look for its new id (in backup tables)
         if ($foundset[0]) {
             //print_object($foundset);                                     //Debug
 
         $searchstring='/\$@(FORUMDISCUSSIONVIEWINSIDE)\*([0-9]+)\*([0-9]+)@\$/';
         //We look for it
-        preg_match_all($searchstring,$content,$foundset);
+        preg_match_all($searchstring,$result,$foundset);
         //If found, then we are going to look for its new id (in backup tables)
         if ($foundset[0]) {
             //print_object($foundset);                                     //Debug
                     $result = forum_decode_content_links($content,$restore);
                     if ($result != $content) {
                         //Update record
-                        $post->message = $result;
+                        $post->message = addslashes($result);
                         $status = update_record("forum_posts",$post);
                         if ($CFG->debug>7) {
                             echo "<br><hr>".$content."<br>changed to</br>".$result."<hr><br>";
             }
         }
 
+        //FORUM: Decode every FORUM (intro) in the coure
+
+        //Check we are restoring forums
+        if ($restore->mods['forum']->restore == 1) {
+            //Get all course forums
+            if ($forums = get_records_sql ("SELECT f.id, f.intro
+                                       FROM {$CFG->prefix}forum f
+                                       WHERE f.course = $restore->course_id")) {
+                //Iterate over each forum->intro
+                $i = 0;   //Counter to send some output to the browser to avoid timeouts
+                foreach ($forums as $forum) {
+                    //Increment counter
+                    $i++;
+                    $content = $forum->intro;
+                    $result = forum_decode_content_links($content,$restore);
+                    if ($result != $content) {
+                        //Update record
+                        $forum->intro = addslashes($result);
+                        $status = update_record("forum",$forum);
+                        if ($CFG->debug>7) {
+                            echo "<br><hr>".$content."<br>changed to</br>".$result."<hr><br>";
+                        }
+                    }
+                    //Do some output
+                    if (($i+1) % 5 == 0) {
+                        echo ".";
+                        if (($i+1) % 100 == 0) {
+                            echo "<br>";
+                        }
+                        backup_flush(300);
+                    }
+                }
+            }
+        }
+
         //RESOURCE: Decode every RESOURCE (alltext) in the coure
 
         //Check we are restoring resources
                     $result = forum_decode_content_links($content,$restore);
                     if ($result != $content) {
                         //Update record
-                        $resource->alltext = $result;
+                        $resource->alltext = addslashes($result);
                         $status = update_record("resource",$resource);
                         if ($CFG->debug>7) {
                             echo "<br><hr>".$content."<br>changed to</br>".$result."<hr><br>";
index bf44447c068075bb299f68032b98371c03757975..deeca2dd08d0d9e059e56883f926de29bc2460f4 100644 (file)
@@ -6,7 +6,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 $module->version  = 2004050300;
-$module->requires = 2004031000;  // Requires this Moodle version
+$module->requires = 2004050300;  // Requires this Moodle version
 $module->cron     = 60;
 
 ?>