Ticket #6700: mythweb-6700-add_ip_address_to_MythBackend_class.patch
File mythweb-6700-add_ip_address_to_MythBackend_class.patch, 1.7 KB (added by , 15 years ago) |
---|
-
classes/MythBackend.php
old new 49 49 return $Backend[$host][$port]; 50 50 } 51 51 52 function __construct($host, $port ) {52 function __construct($host, $port=null) { 53 53 $this->host = $host; 54 $this->port = $port; 54 $this->ip = _or(setting('BackendServerIP', $this->host), $host); 55 $this->port = _or($port, setting('BackendServerPort', $this->host)); 55 56 $this->port_http = _or(setting('BackendStatusPort', $this->host), _or(setting('BackendStatusPort'), 6544)); 56 57 } 57 58 … … 62 63 private function connect() { 63 64 if ($this->connected) 64 65 return; 65 $this->fp = @fsockopen($this-> host, $this->port, $errno, $errstr, 25);66 $this->fp = @fsockopen($this->ip, $this->port, $errno, $errstr, 25); 66 67 if (!$this->fp) 67 custom_error("Unable to connect to the master backend at {$this-> host}:{$this->port}.\nIs it running?");68 custom_error("Unable to connect to the master backend at {$this->ip}:{$this->port} (hostname: {$this->host}).\nIs it running?"); 68 69 $this->connected = true; 69 70 socket_set_timeout($this->fp, 20); 70 71 $this->checkProtocolVersion(); … … 188 189 } 189 190 190 191 public function httpRequest($path, $args = array()) { 191 $url = "http://{$this-> host}:{$this->port_http}/Myth/{$path}?";192 $url = "http://{$this->ip}:{$this->port_http}/Myth/{$path}?"; 192 193 foreach ($args as $key => $value) 193 194 $url .= $key.'='.urlencode($value).'&'; 194 195 return @file_get_contents($url);