]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16072 memory related improvements
authorskodak <skodak>
Sun, 17 Aug 2008 09:31:11 +0000 (09:31 +0000)
committerskodak <skodak>
Sun, 17 Aug 2008 09:31:11 +0000 (09:31 +0000)
mod/forum/db/upgrade.php
mod/forum/lib.php

index 86140586b0e9f871ac88c1db702060de12b83693..c4d26491b48c8ab9a9d7adfef7b12660d076ff78 100644 (file)
@@ -115,7 +115,7 @@ function xmldb_forum_upgrade($oldversion) {
 
         $count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
 
-        if ($rs = $DB->get_recordset_sql("SELECT p.*, d.forum, f.course, cm.id AS cmid $sqlfrom")) {
+        if ($rs = $DB->get_recordset_sql("SELECT p.id, p.attachment, d.forum, f.course, cm.id AS cmid $sqlfrom")) {
 
             $pbar = new progress_bar('migrateforumfiles', 500, true);
 
index 6ec8fa73787ffa3117c05b76259530ec5406d12b..52d671079122f428789e7571a8e4d8ede0f78242 100644 (file)
@@ -3787,7 +3787,7 @@ function forum_move_attachments($discussion, $forumfrom, $forumto) {
     $oldcontext = get_context_instance(CONTEXT_MODULE, $oldcm->id);
 
     // loop through all posts, better not use attachment flag ;-)
-    if ($posts = $DB->get_records('forum_posts', array('discussion'=>$discussion->id))) {
+    if ($posts = $DB->get_records('forum_posts', array('discussion'=>$discussion->id), '', 'id, attachment')) {
         foreach ($posts as $post) {
             if ($oldfiles = $fs->get_area_files($oldcontext->id, 'forum_attachment', $post->id, "id", false)) {
                 foreach ($oldfiles as $oldfile) {