From c48068f87dcb04303f35e5bf481676675942e12d Mon Sep 17 00:00:00 2001
From: skodak <skodak>
Date: Mon, 18 Aug 2008 22:33:36 +0000
Subject: [PATCH] MDL-16075 fixed pg problem

---
 mod/glossary/db/upgrade.php | 5 ++---
 mod/glossary/version.php    | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/mod/glossary/db/upgrade.php b/mod/glossary/db/upgrade.php
index 4abeee0cef..39b21920a9 100644
--- a/mod/glossary/db/upgrade.php
+++ b/mod/glossary/db/upgrade.php
@@ -42,12 +42,11 @@ function xmldb_glossary_upgrade($oldversion) {
                     JOIN {glossary} g ON g.id = ge.glossaryid
                     JOIN {modules} m ON m.name = 'glossary'
                     JOIN {course_modules} cm ON (cm.module = m.id AND cm.instance = g.id)
-                   WHERE ge.attachment <> '$empty' AND ge.attachment <> '1'
-                ORDER BY g.course, g.id";
+                   WHERE ge.attachment <> '$empty' AND ge.attachment <> '1'";
 
         $count = $DB->count_records_sql("SELECT COUNT('x') $sqlfrom");
 
-        if ($rs = $DB->get_recordset_sql("SELECT ge.id, ge.userid, ge.attachment, ge.glossaryid, ge.sourceglossaryid, g.course, cm.id AS cmid $sqlfrom")) {
+        if ($rs = $DB->get_recordset_sql("SELECT ge.id, ge.userid, ge.attachment, ge.glossaryid, ge.sourceglossaryid, g.course, cm.id AS cmid $sqlfrom ORDER BY g.course, g.id")) {
 
             $pbar = new progress_bar('migrateglossaryfiles', 500, true);
 
diff --git a/mod/glossary/version.php b/mod/glossary/version.php
index 61f1705071..4fa3d061d6 100644
--- a/mod/glossary/version.php
+++ b/mod/glossary/version.php
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2008081700;
+$module->version  = 2008081900;
 $module->requires = 2008081600;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
-- 
2.39.5