MDL-16072 memory related improvements

This commit is contained in:
skodak 2008-08-17 09:31:11 +00:00
parent e1266a52f0
commit 1f0e77025d
2 changed files with 2 additions and 2 deletions

View file

@ -115,7 +115,7 @@ function xmldb_forum_upgrade($oldversion) {
$count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom"); $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); $pbar = new progress_bar('migrateforumfiles', 500, true);

View file

@ -3787,7 +3787,7 @@ function forum_move_attachments($discussion, $forumfrom, $forumto) {
$oldcontext = get_context_instance(CONTEXT_MODULE, $oldcm->id); $oldcontext = get_context_instance(CONTEXT_MODULE, $oldcm->id);
// loop through all posts, better not use attachment flag ;-) // 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) { foreach ($posts as $post) {
if ($oldfiles = $fs->get_area_files($oldcontext->id, 'forum_attachment', $post->id, "id", false)) { if ($oldfiles = $fs->get_area_files($oldcontext->id, 'forum_attachment', $post->id, "id", false)) {
foreach ($oldfiles as $oldfile) { foreach ($oldfiles as $oldfile) {