Skip to content

Commit

Permalink
Update StaticpagesController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
michelsteege authored May 2, 2018
1 parent 1bf9ed2 commit 5675f11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Controllers/StaticpagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ public function transformURL($url)
//Fix url for subsites
$httpHost = $_SERVER['HTTP_HOST'];
if(class_exists('SilverStripe\Subsites\Model\Subsite')){

$httpHost = \SilverStripe\Subsites\Model\Subsite::currentSubsite()->domain();
$currentSubsite = \SilverStripe\Subsites\Model\Subsite::currentSubsite();
if($currentSubsite){
$httpHost = $currentSubsite->domain();
}
}
$newURL = str_replace($parts['host'], $httpHost, $url);

Expand Down Expand Up @@ -258,8 +260,10 @@ public function removeAll($currentSubsiteOnly = false)
$subDir = '';
if($currentSubsiteOnly){
if(class_exists('SilverStripe\Subsites\Model\Subsite')){
$httpHost = \SilverStripe\Subsites\Model\Subsite::currentSubsite()->domain();
$subDir = '/' . $httpHost;
$currentSubsite = \SilverStripe\Subsites\Model\Subsite::currentSubsite();
if($currentSubsite){
$subDir = '/' . $currentSubsite->domain();
}
}
}
$staticpath = Director::baseFolder() . '/' . $this->_cachepath . $subDir;
Expand Down

0 comments on commit 5675f11

Please sign in to comment.