Commit 5662b801 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Revert "Remove wwwroot from the database (bug #780177)""

parents 501e5499 5266d1b4
......@@ -157,7 +157,8 @@ catch (SQLException $e) {
db_ignore_sql_exceptions(false);
}
// Make sure wwwroot is set. If it is not defined in the config, then determine it.
// Make sure wwwroot is set and available, either in the database or in the
// config file. Cron requires it when sending out forums emails.
if (!isset($CFG->wwwroot) && isset($_SERVER['HTTP_HOST'])) {
$proto = (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https://' : 'http://';
$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
......@@ -195,9 +196,15 @@ if (!isset($CFG->wwwroot) && isset($_SERVER['HTTP_HOST'])) {
} else {
$path = '/';
}
$CFG->wwwroot = $proto . $host . $path;
$wwwroot = $proto . $host . $path;
try {
set_config('wwwroot', $wwwroot);
}
catch (Exception $e) {
// Just set it directly. The system will most likely not be installed, so we don't care
$CFG->wwwroot = $wwwroot;
}
}
if (isset($CFG->wwwroot)) {
if (substr($CFG->wwwroot, -1, 1) != '/') {
$CFG->wwwroot .= '/';
......
......@@ -2271,11 +2271,6 @@ function xmldb_core_upgrade($oldversion=0) {
change_field_precision($table, $field);
}
if ($oldversion < 2011051300) {
// We do not store wwwroot in the database any more
delete_records('config','field','wwwroot');
}
if ($oldversion < 2011051700) {
// Create new "external" category
insert_record('blocktype_category', (object) array('name' => 'external'));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment