Skip to content

Commit

Permalink
MDL-28030 setup: Ensure $CFG->urlrewriteclass is properly setup
Browse files Browse the repository at this point in the history
(To avoid crippling a site)
  • Loading branch information
danpoltawski authored and stronk7 committed Feb 16, 2016
1 parent cfdc1bb commit cbce7be
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,17 @@
apache_note('MOODLEUSER', $logname);
}

// Ensure the urlrewriteclass is setup correctly (to avoid crippling site).
if (isset($CFG->urlrewriteclass)) {
if (!class_exists($CFG->urlrewriteclass)) {
debugging("urlrewriteclass {$CFG->urlrewriteclass} was not found, disabling.");
unset($CFG->urlrewriteclass);
} else if (!in_array('core\output\url_rewriter', class_implements($CFG->urlrewriteclass))) {
debugging("{$CFG->urlrewriteclass} does not implement core\output\url_rewriter, disabling.", DEBUG_DEVELOPER);
unset($CFG->urlrewriteclass);
}
}

// Use a custom script replacement if one exists
if (!empty($CFG->customscripts)) {
if (($customscript = custom_script_path()) !== false) {
Expand Down

0 comments on commit cbce7be

Please sign in to comment.