From 52c806a671d8f782f128edeefe8f42977e4c1907 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Thu, 1 Jan 2015 15:13:34 +0100 Subject: [PATCH] Fix possible issue checking the courses directory during installation on a host with default IP --- main/install/install.lib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main/install/install.lib.php b/main/install/install.lib.php index 9281b7bb1d..24b85dd608 100755 --- a/main/install/install.lib.php +++ b/main/install/install.lib.php @@ -2185,6 +2185,13 @@ function check_course_script_interpretation($course_dir, $course_attempt_name, $ $parsed_url = parse_url($url); //$scheme = isset($parsedUrl['scheme']) ? $parsedUrl['scheme'] : ''; //http $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; + // Patch if the host is the default host and is used through + // the IP address (sometimes the host is not taken correctly + // in this case) + if (empty($host) && !empty($_SERVER['HTTP_HOST'])) { + $host = $_SERVER['HTTP_HOST']; + $url = preg_replace('#:///#', '://'.$host.'/', $url); + } $path = isset($parsed_url['path']) ? $parsed_url['path'] : '/'; $port = isset($parsed_url['port']) ? $parsed_url['port'] : '80';