From 61ed3df36742a15255617c5b8e106dc720526fcd Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Tue, 14 Jul 2009 01:21:04 +0000 Subject: [PATCH] MINOR fixed relative URL resolver in Director::test() MINOR improved documentation in static-main.php git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81749 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/control/Director.php | 5 ++++- static-main.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/control/Director.php b/core/control/Director.php index c8c9b9a5f..3d3979e8a 100644 --- a/core/control/Director.php +++ b/core/control/Director.php @@ -198,7 +198,10 @@ class Director { if (@parse_url($url, PHP_URL_HOST) != '') { $bits = parse_url($url); $_SERVER['HTTP_HOST'] = $bits['host']; - $url = Director::makeRelative($url); + // Implementing a custom absolute->relative code snippet as + // Director::makeRelative() chokes on a url like http://localhost + // it will just return the original string, not /, or ''. + $url = (isset($bits['path']) ? $bits['path'] : '/') . (isset($bits['query']) ? '?'.$bits['query'] : '') . (isset($bits['fragment']) ? '#'.$bits['fragment'] : ''); } $urlWithQuerystring = $url; diff --git a/static-main.php b/static-main.php index ef7395ac4..67aa0c81d 100644 --- a/static-main.php +++ b/static-main.php @@ -8,6 +8,9 @@ * * If you are using StaticPublisher+Subsites, set the following in _config.php: * FilesystemPublisher::$domain_based_caching = true; + * If you are not using subsites, the host-map.php file will not exist (it is + * automatically generated by the Subsites module) and the cache will default + * to no subdirectory. */ if (file_exists('../subsites/host-map.php')) {