Skip to content

Commit

Permalink
MDL-42863 make capabilities overview more fault-tolerant.
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Nov 15, 2013
1 parent b3f2d75 commit c48f58b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions admin/tool/capability/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,15 @@
// Put the contexts into a tree structure.
foreach ($contexts as $conid => $con) {
$context = context::instance_by_id($conid);
$parentcontextid = get_parent_contextid($context);
if ($parentcontextid) {
$contexts[$parentcontextid]->children[] = $conid;
try {
$parentcontext = $context->get_parent_context();
if ($parentcontext) { // Will be false if $context is the system context.
$contexts[$parentcontext->id]->children[] = $conid;
}
} catch (dml_missing_record_exception $e) {
// Ignore corrupt context tree structure here. Don't let it break
// showing the rest of the report.
continue;
}
}

Expand Down

0 comments on commit c48f58b

Please sign in to comment.