Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-34471 libraries: changing strictness of context_XXXX::instance() …

…when needed
  • Loading branch information...
commit 0d4d49d18aa1f3e9bc780b2249d9d14200ceddcb 1 parent bf0f06b
Ankit Agarwal ankitagarwal authored

Showing 2 changed files with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. +7 7 group/externallib.php
  2. +1 1  mod/forum/index.php
14 group/externallib.php
@@ -89,7 +89,7 @@ public static function create_groups($groups) {
89 89 }
90 90
91 91 // now security checks
92   - $context = context_course::instance($group->courseid);
  92 + $context = context_course::instance($group->courseid, IGNORE_MISSING);
93 93 try {
94 94 self::validate_context($context);
95 95 } catch (Exception $e) {
@@ -168,7 +168,7 @@ public static function get_groups($groupids) {
168 168 $group = groups_get_group($groupid, 'id, courseid, name, description, descriptionformat, enrolmentkey', MUST_EXIST);
169 169
170 170 // now security checks
171   - $context = context_course::instance($group->courseid);
  171 + $context = context_course::instance($group->courseid, IGNORE_MISSING);
172 172 try {
173 173 self::validate_context($context);
174 174 } catch (Exception $e) {
@@ -235,7 +235,7 @@ public static function get_course_groups($courseid) {
235 235 $params = self::validate_parameters(self::get_course_groups_parameters(), array('courseid'=>$courseid));
236 236
237 237 // now security checks
238   - $context = context_course::instance($params['courseid']);
  238 + $context = context_course::instance($params['courseid'], IGNORE_MISSING);
239 239 try {
240 240 self::validate_context($context);
241 241 } catch (Exception $e) {
@@ -318,7 +318,7 @@ public static function delete_groups($groupids) {
318 318 }
319 319
320 320 // now security checks
321   - $context = context_course::instance($group->courseid);
  321 + $context = context_course::instance($group->courseid, IGNORE_MISSING);
322 322 try {
323 323 self::validate_context($context);
324 324 } catch (Exception $e) {
@@ -376,7 +376,7 @@ public static function get_group_members($groupids) {
376 376 // validate params
377 377 $group = groups_get_group($groupid, 'id, courseid, name, enrolmentkey', MUST_EXIST);
378 378 // now security checks
379   - $context = context_course::instance($group->courseid);
  379 + $context = context_course::instance($group->courseid, IGNORE_MISSING);
380 380 try {
381 381 self::validate_context($context);
382 382 } catch (Exception $e) {
@@ -456,7 +456,7 @@ public static function add_group_members($members) {
456 456 $user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
457 457
458 458 // now security checks
459   - $context = context_course::instance($group->courseid);
  459 + $context = context_course::instance($group->courseid, IGNORE_MISSING);
460 460 try {
461 461 self::validate_context($context);
462 462 } catch (Exception $e) {
@@ -534,7 +534,7 @@ public static function delete_group_members($members) {
534 534 $user = $DB->get_record('user', array('id'=>$userid, 'deleted'=>0, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
535 535
536 536 // now security checks
537   - $context = context_course::instance($group->courseid);
  537 + $context = context_course::instance($group->courseid, IGNORE_MISSING);
538 538 try {
539 539 self::validate_context($context);
540 540 } catch (Exception $e) {
2  mod/forum/index.php
@@ -129,7 +129,7 @@
129 129
130 130 $forum = $forums[$forumid];
131 131
132   - if (!$context = context_module::instance($cm->id)) {
  132 + if (!$context = context_module::instance($cm->id, IGNORE_MISSING)) {
133 133 continue; // Shouldn't happen
134 134 }
135 135

0 comments on commit 0d4d49d

Please sign in to comment.
Something went wrong with that request. Please try again.