Commit 6acb045a authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Fixed dataroot paths not having a trailing slash early enough, causing

big fat boom
parent 901c5842
...@@ -51,6 +51,11 @@ if (!is_readable($CFG->docroot . 'config.php')) { ...@@ -51,6 +51,11 @@ if (!is_readable($CFG->docroot . 'config.php')) {
require('config.php'); require('config.php');
$CFG = (object)array_merge((array)$cfg, (array)$CFG); $CFG = (object)array_merge((array)$cfg, (array)$CFG);
// Fix up paths in $CFG
foreach (array('docroot', 'dataroot') as $path) {
$CFG->{$path} = realpath((substr($CFG->{$path}, -1) != DIRECTORY_SEPARATOR) ? $CFG->{$path} . DIRECTORY_SEPARATOR : $CFG->{$path}) . "/";
}
// xmldb stuff // xmldb stuff
$CFG->xmldbdisablenextprevchecking = true; $CFG->xmldbdisablenextprevchecking = true;
$CFG->xmldbdisablecommentchecking = true; $CFG->xmldbdisablecommentchecking = true;
...@@ -109,10 +114,8 @@ catch (SQLException $e) { ...@@ -109,10 +114,8 @@ catch (SQLException $e) {
} }
} }
// Fix up paths in $CFG // Make sure wwwroot is set and available, either in the database or int the
foreach (array('docroot', 'dataroot') as $path) { // config file. Cron requires it for some purposes.
$CFG->{$path} = realpath((substr($CFG->{$path}, -1) != DIRECTORY_SEPARATOR) ? $CFG->{$path} . DIRECTORY_SEPARATOR : $CFG->{$path}) . "/";
}
if (!isset($CFG->wwwroot) && isset($_SERVER['HTTP_HOST'])) { if (!isset($CFG->wwwroot) && isset($_SERVER['HTTP_HOST'])) {
$proto = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://'; $proto = (isset($_SERVER['HTTPS'])) ? 'https://' : 'http://';
$host = (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']; $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'];
......
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