From 902177383b38140eb5615cc146ea88f6d9acbf59 Mon Sep 17 00:00:00 2001
From: Chris Edwards <cedwards@wcs.k12.va.us>
Date: Wed, 13 Jun 2012 10:55:22 -0400
Subject: [PATCH] MDL-26892 Fixed quiz image for system context

Quizzes that had questions in a system category had images in the site
folder so that the questions could be copied to other courses were not
being migrated successfully because the migration was using the system
context rather than the course context. During the migration, images
were being stored according to the course, so use of the course context
correctly found the images needed and appended the image tag at the
end of the questiontext field.
---
 lib/db/upgrade.php |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php
index d575db7..e8b65ef 100644
--- a/lib/db/upgrade.php
+++ b/lib/db/upgrade.php
@@ -4992,7 +4992,8 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
                         break;
                     case CONTEXT_COURSECAT :
                     case CONTEXT_SYSTEM :
-                        $context = get_system_context();
+                        $system_context = get_system_context();
+                        $context = get_context_instance(CONTEXT_COURSE, $system_context->id);
                         break;
                     default :
                         continue;
-- 
1.7.2.5

