mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-51242 messageinbound: Guess the port from hostspec
Existing language strings for the host component suggest that the host can be provided in the format hostname:port, but we previously did not support this. This patch explodes the string based on the colon character and assumes that if there are two parts, that they are in the format hostname:port. Note: This does not attempt to deal with full host specifications (e.g. protocol://hostname:port), as this is beyond the scope of this change.
This commit is contained in:
parent
ac8d6cff54
commit
275480a0de
@ -103,6 +103,15 @@ class manager {
|
||||
'debug' => empty($CFG->debugimap) ? null : fopen('php://stderr', 'w'),
|
||||
);
|
||||
|
||||
if (strpos($configuration['hostspec'], ':')) {
|
||||
$hostdata = explode(':', $configuration['hostspec']);
|
||||
if (count($hostdata) === 2) {
|
||||
// A hostname in the format hostname:port has been provided.
|
||||
$configuration['hostspec'] = $hostdata[0];
|
||||
$configuration['port'] = $hostdata[1];
|
||||
}
|
||||
}
|
||||
|
||||
$this->client = new \Horde_Imap_Client_Socket($configuration);
|
||||
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user