Skip to content

Commit

Permalink
MDL-36091 added debugging() calls in blocks of code marked as "should…
Browse files Browse the repository at this point in the history
… never happen"
  • Loading branch information
andyjdavis authored and danpoltawski committed Feb 11, 2013
1 parent 06d8f38 commit c90e6b4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin/tool/uploaduser/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
}
if (!property_exists($user, $column) or !property_exists($existinguser, $column)) {
// this should never happen
debugging("Could not find $column on the user objects", DEBUG_DEVELOPER);
continue;
}
if ($updatetype == UU_UPDATE_MISSING) {
Expand Down
1 change: 1 addition & 0 deletions enrol/manual/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ function enrol_manual_migrate_plugin_enrolments($enrol) {

if (!$minstance) {
// This should never happen unless adding of default instance fails unexpectedly.
debugging('Failed to find manual enrolment instance', DEBUG_DEVELOPER);
continue;
}

Expand Down
2 changes: 2 additions & 0 deletions grade/edit/outcome/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
$scale = $outcome->load_scale();
if (empty($scale->id)) { // hopefully never happens
$line[] = $scale->get_name();
debugging("Found a scale with no ID ({$scale->get_name()}) while outputting course outcomes", DEBUG_DEVELOPER);
} else {
if (empty($scale->courseid)) {
$caneditthisscale = $caneditsystemscales;
Expand Down Expand Up @@ -181,6 +182,7 @@
$scale = $outcome->load_scale();
if (empty($scale->id)) { // hopefully never happens
$line[] = $scale->get_name();
debugging("Found a scale with no ID ({$scale->get_name()}) while outputting global outcomes", DEBUG_DEVELOPER);
} else {
if (empty($scale->courseid)) {
$caneditthisscale = $caneditsystemscales;
Expand Down
2 changes: 2 additions & 0 deletions lib/accesslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ function has_capability($capability, context $context, $user = null, $doanything
if (!isset($USER->id)) {
// should never happen
$USER->id = 0;
debugging('Capability check being performed on a user with no ID.', DEBUG_DEVELOPER);
}

// make sure there is a real user specified
Expand Down Expand Up @@ -2062,6 +2063,7 @@ function can_access_course(stdClass $course, $user = null, $withcapability = '',
if (!isset($USER->id)) {
// should never happen
$USER->id = 0;
debugging('Course access check being performed on a user with no ID.', DEBUG_DEVELOPER);
}

// make sure there is a user specified
Expand Down
4 changes: 3 additions & 1 deletion lib/datalib.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ function get_admin() {
static $mainadmin = null;
static $prevadmins = null;

if (empty($CFG->siteadmins)) { // Should not happen on an ordinary site.
if (empty($CFG->siteadmins)) {
// Should not happen on an ordinary site.
// It does however happen during unit tests.
return false;
}

Expand Down

0 comments on commit c90e6b4

Please sign in to comment.