MDL-15148
In fact, getting IP lookup too from MDL-15008 by Lue Hudson.
This commit is contained in:
+12
-1
@@ -155,7 +155,18 @@ class mnet_environment {
|
||||
$this->wwwroot = $CFG->wwwroot;
|
||||
$details = openssl_x509_parse($this->public_key);
|
||||
$this->public_key_expires = $details['validTo_time_t'];
|
||||
|
||||
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'];
|
||||
}
|
||||
set_config('openssl', implode('@@@@@@@@', $this->keypair), 'mnet');
|
||||
|
||||
update_record('mnet_host', $this);
|
||||
|
||||
Reference in New Issue
Block a user