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 1, 2018
1 parent 59468e8 commit 389cd2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Controllers/StaticpagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,16 @@ public function install()
/**
* Remove all cache
*/
public function removeAll()
public function removeAll($currentSubsiteOnly = false)
{
$staticpath = Director::baseFolder() . '/' . $this->_cachepath;
$subDir = '';
if($currentSubsiteOnly){
if(class_exists('SilverStripe\Subsites\Model\Subsite')){
$httpHost = \SilverStripe\Subsites\Model\Subsite::currentSubsite()->domain();
$subDir = '/' . $httpHost;
}
}
$staticpath = Director::baseFolder() . '/' . $this->_cachepath . $subDir;
if (is_dir($staticpath)) {
$dirs = array_filter(glob($staticpath . '/*'), 'is_dir');
foreach ($dirs as $dir) {
Expand Down

0 comments on commit 389cd2a

Please sign in to comment.