mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX: Correct StaticPublisher filenames, now works with nested URLS
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99465 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
12761de90b
commit
1091dafdf0
@ -49,7 +49,13 @@ class FilesystemPublisher extends StaticPublisher {
|
||||
foreach($urls as $url) {
|
||||
$urlParts = @parse_url($url);
|
||||
$urlParts['path'] = isset($urlParts['path']) ? $urlParts['path'] : '';
|
||||
$urlSegment = preg_replace('/[^a-zA-Z0-9]/si', '_', trim($urlParts['path'], '/'));
|
||||
// perform similar transformations to SiteTree::generateURLSegment()
|
||||
$urlSegment = $urlParts['path'];
|
||||
$urlSegment = str_replace('&','-and-',$urlSegment);
|
||||
$urlSegment = str_replace('&','-and-',$urlSegment);
|
||||
$urlSegment = ereg_replace('[^A-Za-z0-9\/-]+','-',$urlSegment);
|
||||
$urlSegment = ereg_replace('-+','-',$urlSegment);
|
||||
$urlSegment = trim($urlSegment, '/');
|
||||
|
||||
$filename = $urlSegment ? "$urlSegment.$this->fileExtension" : "index.$this->fileExtension";
|
||||
|
||||
@ -113,7 +119,7 @@ class FilesystemPublisher extends StaticPublisher {
|
||||
echo " * Publishing page $i/$totalURLs: $url\n";
|
||||
flush();
|
||||
}
|
||||
|
||||
|
||||
Requirements::clear();
|
||||
$response = Director::test(str_replace('+', ' ', $url));
|
||||
Requirements::clear();
|
||||
|
Loading…
Reference in New Issue
Block a user