MDL-45258 tags:context object/0 should not be passed to tag_set()

This commit is contained in:
Ankit Agarwal 2014-04-28 14:20:22 +08:00
parent 83ddacfff7
commit a9282e4120
2 changed files with 4 additions and 1 deletions

View File

@ -1215,6 +1215,9 @@ abstract class restore_dbops {
$usertag = (object)$usertag;
$tags[] = $usertag->rawname;
}
if (empty($newuserctxid)) {
$newuserctxid = null; // Tag apis expect a null contextid not 0.
}
tag_set('user', $newuserid, $tags, 'core', $newuserctxid);
}

View File

@ -136,7 +136,7 @@ if ($tagnew = $tagform->get_data()) {
}
//updated related tags
tag_set('tag', $tagnew->id, explode(',', trim($tagnew->relatedtags)), 'core', $systemcontext);
tag_set('tag', $tagnew->id, explode(',', trim($tagnew->relatedtags)), 'core', $systemcontext->id);
//print_object($tagnew); die();
redirect($CFG->wwwroot.'/tag/index.php?tag='.rawurlencode($tag->name)); // must use $tag here, as the name isn't in the edit form