mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Patch for upgrade breakage on IIS (and maybe other non-Apache webservers) MDL-8926
This commit is contained in:
parent
7e7b0ef002
commit
c13722179f
1 changed files with 12 additions and 1 deletions
|
@ -32,7 +32,18 @@ class mnet_environment {
|
||||||
if (empty($CFG->mnet_localhost_id) ) {
|
if (empty($CFG->mnet_localhost_id) ) {
|
||||||
|
|
||||||
$this->wwwroot = $CFG->wwwroot;
|
$this->wwwroot = $CFG->wwwroot;
|
||||||
$this->ip_address = $_SERVER['SERVER_ADDR'];
|
if(empty($_SERVER['SERVER_ADDR'])) {
|
||||||
|
// SERVER_ADDR is only returned by Apache-like webservers
|
||||||
|
$my_hostname = mnet_get_hostname_from_uri($CFG->wwwroot);
|
||||||
|
$my_ip = gethostbyname($my_hostname); // Returns unmodified hostname on failure. DOH!
|
||||||
|
if($my_ip == $my_hostname) {
|
||||||
|
$this->ip_address = 'UNKNOWN';
|
||||||
|
} else {
|
||||||
|
$this->ip_address = $my_ip;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->ip_address = $_SERVER['SERVER_ADDR'];
|
||||||
|
}
|
||||||
$this->id = insert_record('mnet_host', $this, true);
|
$this->id = insert_record('mnet_host', $this, true);
|
||||||
|
|
||||||
set_config('mnet_localhost_id', $this->id);
|
set_config('mnet_localhost_id', $this->id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue