Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"MDL-19118, fixed glossary module comment migration"
  • Loading branch information
Dongsheng Cai committed May 3, 2010
1 parent 8fd603a commit 51f93f4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions mod/glossary/db/upgrade.php
Expand Up @@ -215,6 +215,7 @@ function xmldb_glossary_upgrade($oldversion) {
if ($dbman->table_exists($table)) {
$sql = 'SELECT e.glossaryid AS glossaryid,
g.course AS courseid,
c.userid,
e.id AS itemid,
c.id AS old_id,
c.entrycomment AS commentcontent,
Expand All @@ -238,17 +239,16 @@ function xmldb_glossary_upgrade($oldversion) {
$lastglossaryid = $res->glossaryid;
$lastcourseid = $res->courseid;
}
list($context, $course, $cm) = get_context_info_array($contextid);
$cmt = new stdclass;
$cmt->pluginname = 'glossary';
$cmt->context = $modcontext;
$cmt->courseid = $res->courseid;
$cmt->cm = $cm;
$cmt->area = 'glossary_entry';
$cmt->itemid = $res->itemid;
$comment = new comment($cmt);
$cmt = $comment->add($res->commentcontent, $res->format);
if (!empty($cmt)) {
$cmt->contextid = $modcontext->id;
$cmt->commentarea = 'glossary_entry';
$cmt->itemid = $res->itemid;
$cmt->content = $res->commentcontent;
$cmt->format = $res->format;
$cmt->userid = $res->userid;
$cmt->timecreated = $res->timemodified;
$cmt_id = $DB->insert_record('comments', $cmt);
if (!empty($cmt_id)) {
$DB->delete_records('glossary_comments', array('id'=>$res->old_id));
}
}
Expand Down

0 comments on commit 51f93f4

Please sign in to comment.