Skip to content

Commit

Permalink
Merge branch 'MDL_71012_master' of https://github.com/jessansell/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Apr 19, 2021
2 parents 64ae826 + 52bc582 commit d649ec2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@
// Normalise dataroot - we do not want any symbolic links, trailing / or any other weirdness there
if (!isset($CFG->dataroot)) {
if (isset($_SERVER['REMOTE_ADDR'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable');
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error ');
}
echo('Fatal error: $CFG->dataroot is not specified in config.php! Exiting.'."\n");
exit(1);
}
$CFG->dataroot = realpath($CFG->dataroot);
if ($CFG->dataroot === false) {
if (isset($_SERVER['REMOTE_ADDR'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable');
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error ');
}
echo('Fatal error: $CFG->dataroot is not configured properly, directory does not exist or is not accessible! Exiting.'."\n");
exit(1);
} else if (!is_writable($CFG->dataroot)) {
if (isset($_SERVER['REMOTE_ADDR'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable');
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error ');
}
echo('Fatal error: $CFG->dataroot is not writable, admin has to fix directory permissions! Exiting.'."\n");
exit(1);
Expand All @@ -170,7 +170,7 @@
// wwwroot is mandatory
if (!isset($CFG->wwwroot) or $CFG->wwwroot === 'http://example.com/moodle') {
if (isset($_SERVER['REMOTE_ADDR'])) {
header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service Unavailable');
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error ');
}
echo('Fatal error: $CFG->wwwroot is not configured! Exiting.'."\n");
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion lib/setuplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ public static function early_error($message, $moreinfourl, $link, $backtrace, $d
// In the name of protocol correctness, monitoring and performance
// profiling, set the appropriate error headers for machine consumption.
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
@header($protocol . ' 503 Service Unavailable');
@header($protocol . ' 500 Internal Server Error');

// better disable any caching
@header('Content-Type: text/html; charset=utf-8');
Expand Down

0 comments on commit d649ec2

Please sign in to comment.