Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Run Cache Flush Command (for Varnish) on Publish


Reply

9 Posts   887 Views

Avatar
Bam

16 September 2013 at 3:40pm Community Member, 16 Posts

Brilliant, that did the trick:

public function onAfterWrite() {
if($this->ParentID) {
$top = $this->getAncestors()->First();
} else {
$top = $this;
}
$cmd = escapeshellarg('ban.url ' . $top->Link());
system('varnishadm -T :6082 ' . $cmd);
return true;
}

Thanks again!