Skip to content

Commit

Permalink
MDL-11061 - admin notifications about $CFG->wwwroot, which sometimes …
Browse files Browse the repository at this point in the history
…lead to obscure errors. Merged from MOODLE_19_STABLE.
  • Loading branch information
tjhunt committed Oct 17, 2007
1 parent bfbef96 commit 93b2ed9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions admin/index.php
Expand Up @@ -574,6 +574,13 @@
print_box(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot), 'generalbox adminwarning');
}

if (substr($CFG->wwwroot, -1) == '/') {
print_box(get_string('cfgwwwrootslashwarning', 'admin'), 'generalbox adminwarning');
}
if (strpos($ME, $CFG->httpswwwroot.'/') === false) {
print_box(get_string('cfgwwwrootwarning', 'admin'), 'generalbox adminwarning');
}

/// If no recently cron run
$lastcron = get_field_sql('SELECT max(lastcron) FROM ' . $CFG->prefix . 'modules');
if (time() - $lastcron > 3600 * 24) {
Expand Down
2 changes: 2 additions & 0 deletions lang/en_utf8/admin.php
Expand Up @@ -36,6 +36,8 @@
$string['cachetype'] = 'Cache Type';
$string['calendar_weekend'] = 'Weekend Days';
$string['calendarsettings'] = 'Calendar';
$string['cfgwwwrootwarning'] = 'You have defined &#36;CFG->wwwroot incorrectly in your config.php file. It does not match the URL you are using to access this page. Please correct it, or you will experience strange bugs like <a href=\'http://tracker.moodle.org/browse/MDL-11061\'>MDL-11061</a>.';
$string['cfgwwwrootslashwarning'] = 'You have defined &#36;CFG->wwwroot incorrectly in your config.php file. You have included a \'/\' character at the end. Please remove it, or you will experience strange bugs like <a href=\'http://tracker.moodle.org/browse/MDL-11061\'>MDL-11061</a>.';
$string['change'] = 'change';
$string['changesitelang'] = 'Change site language';
$string['choosefiletoedit'] = 'Choose file to edit';
Expand Down
3 changes: 3 additions & 0 deletions lib/weblib.php
Expand Up @@ -271,6 +271,9 @@ function qualified_me() {
}
}

// TODO, this does not work in the situation described in MDL-11061, but
// I don't know how to fix it. Possibly believe $CFG->wwwroot ahead of what
// the server reports.
if (isset($_SERVER['HTTPS'])) {
$protocol = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
} else if (isset($_SERVER['SERVER_PORT'])) { # Apache2 does not export $_SERVER['HTTPS']
Expand Down

0 comments on commit 93b2ed9

Please sign in to comment.