mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 09:05:53 +00:00
BUGFIX Fixed publication of homepage with '/' URL through StaticPublisher (fixes #5514, thanks ktauber)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@103960 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
db44725062
commit
aeacbafe16
@ -72,12 +72,16 @@ abstract class StaticPublisher extends DataObjectDecorator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: Similiar to RebuildStaticCacheTask->rebuildCache()
|
||||||
foreach($urls as $i => $url) {
|
foreach($urls as $i => $url) {
|
||||||
if(!is_string($url)) {
|
if(!is_string($url)) {
|
||||||
user_error("Bad URL: " . var_export($url, true), E_USER_WARNING);
|
user_error("Bad URL: " . var_export($url, true), E_USER_WARNING);
|
||||||
continue;
|
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[$i] = $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,13 +54,16 @@ class RebuildStaticCacheTask extends Controller {
|
|||||||
|
|
||||||
touch($cacheBaseDir.'/lock');
|
touch($cacheBaseDir.'/lock');
|
||||||
|
|
||||||
|
// Note: Similiar to StaticPublisher->republish()
|
||||||
foreach($urls as $i => $url) {
|
foreach($urls as $i => $url) {
|
||||||
if($url && !is_string($url)) {
|
if($url && !is_string($url)) {
|
||||||
user_error("Bad URL: " . var_export($url, true), E_USER_WARNING);
|
user_error("Bad URL: " . var_export($url, true), E_USER_WARNING);
|
||||||
continue;
|
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[$i] = $url;
|
||||||
}
|
}
|
||||||
$urls = array_unique($urls);
|
$urls = array_unique($urls);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user