rating MDL-21657 Fixed 2 upgrade problems

This commit is contained in:
Andrew Davis
2010-03-16 06:59:34 +00:00
parent 1d50dd13f6
commit 158cd5d91a
2 changed files with 5 additions and 3 deletions
+3 -1
View File
@@ -3076,7 +3076,9 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL");
$table->add_index('itemid', XMLDB_INDEX_NOTUNIQUE, array('itemid'));
/// Create table for ratings
$dbman->create_table($table);
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
//migrate ratings out of the modules into the central ratings table
+2 -2
View File
@@ -411,7 +411,7 @@ function upgrade_module_ratings($ratingssql, $modulename) {
upgrade_set_timeout(60);//prevent a timeout
}
//all posts within a given forum will have the same context id so store them in an array
//all posts within a given forum, glossary etc will have the same context id so store them in an array
if( !array_key_exists($old_rating->mid, $contextarray) ) {
$sql = 'select cxt.id from {course_modules} cm inner join {modules} m on cm.module=m.id
inner join {context} cxt on cxt.instanceid=cm.id
@@ -436,7 +436,7 @@ where m.name=:modulename and cm.instance=:moduleinstanceid and cxt.contextlevel=
$result = $result && $DB->insert_record('ratings', $rating);
}
$ratings->close();
//$ratings->close();
return $result;
}