Skip to content

Commit

Permalink
BUGFIX Fixed publication of homepage with '/' URL through StaticPubli…
Browse files Browse the repository at this point in the history
…sher (fixes #5514, thanks ktauber) (from r103960)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@112449 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Oct 15, 2010
1 parent b78bc13 commit 1d7b62b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion code/staticpublisher/StaticPublisher.php
Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion tasks/RebuildStaticCacheTask.php
Expand Up @@ -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);
Expand Down

0 comments on commit 1d7b62b

Please sign in to comment.