Permalink
Browse files

MDL-34462 cohort: remove uncessary MUST_EXIST params

(its now the default)
  • Loading branch information...
danpoltawski committed Jul 24, 2012
1 parent e0bbad5 commit abdf2b675b8104cdd8108917c6c8a3e7b4b6456e
Showing with 4 additions and 4 deletions.
  1. +1 −1 cohort/edit_form.php
  2. +3 −3 cohort/lib.php
View
@@ -98,7 +98,7 @@ protected function get_category_options($currentcontextid) {
$options[$syscontext->id] = print_context_name($syscontext);
}
foreach ($displaylist as $cid=>$name) {
$context = context_coursecat::instance($cid, MUST_EXIST);
$context = context_coursecat::instance($cid);
$options[$context->id] = $name;
}
// always add current - this is not likely, but if the logic gets changed it might be a problem
View
@@ -110,10 +110,10 @@ function cohort_delete_category($category) {
global $DB;
// TODO: make sure that cohorts are really, really not used anywhere and delete, for now just move to parent or system context
$oldcontext = context_coursecat::instance($category->id, MUST_EXIST);
$oldcontext = context_coursecat::instance($category->id);
if ($category->parent and $parent = $DB->get_record('course_categories', array('id'=>$category->parent))) {
$parentcontext = context_coursecat::instance($parent->id, MUST_EXIST);
$parentcontext = context_coursecat::instance($parent->id);
$sql = "UPDATE {cohort} SET contextid = :newcontext WHERE contextid = :oldcontext";
$params = array('oldcontext'=>$oldcontext->id, 'newcontext'=>$parentcontext->id);
} else {
@@ -165,7 +165,7 @@ function cohort_remove_member($cohortid, $userid) {
function cohort_get_visible_list($course) {
global $DB, $USER;
$context = context_course::instance($course->id, MUST_EXIST);
$context = context_course::instance($course->id);
list($esql, $params) = get_enrolled_sql($context);
$parentsql = get_related_contexts_string($context);

0 comments on commit abdf2b6

Please sign in to comment.