Permalink
Browse files

BUGFIX Fixed publication of homepage with '/' URL through StaticPubli…

…sher (fixes #5514, thanks ktauber)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@103960 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent db44725 commit aeacbafe16b967d392cd647b3175091c9b2e863c @chillu chillu committed with sminnee May 3, 2010
Showing with 9 additions and 2 deletions.
  1. +5 −1 code/staticpublisher/StaticPublisher.php
  2. +4 −1 tasks/RebuildStaticCacheTask.php
@@ -72,12 +72,16 @@ function republish($original) {
}
}
+ // Note: Similiar to RebuildStaticCacheTask->rebuildCache()
foreach($urls as $i => $url) {
if(!is_string($url)) {
user_error("Bad URL: " . var_export($url, true), E_USER_WARNING);
continue;
}
- if(substr($url,-1) == '/') $url = substr($url,0,-1);
+
+ // Remove leading slashes from all URLs (apart from the homepage)
+ if(substr($url,-1) == '/' && $url != '/') $url = substr($url,0,-1);
+
$urls[$i] = $url;
}
@@ -54,13 +54,16 @@ function rebuildCache($urls, $removeAll = true) {
touch($cacheBaseDir.'/lock');
+ // Note: Similiar to StaticPublisher->republish()
foreach($urls as $i => $url) {
if($url && !is_string($url)) {
user_error("Bad URL: " . var_export($url, true), E_USER_WARNING);
continue;
}
- if(substr($url,-1) == '/') $url = substr($url,0,-1);
+ // Remove leading slashes from all URLs (apart from the homepage)
+ if(substr($url,-1) == '/' && $url != '/') $url = substr($url,0,-1);
+
$urls[$i] = $url;
}
$urls = array_unique($urls);

0 comments on commit aeacbaf

Please sign in to comment.