Source of file SimpleCacheControllerExtension.php
Size: 0,622 Bytes - Last Modified: 2021-12-23T10:26:52+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/SimpleCacheControllerExtension.php
12345678910111213141516171819202122232425 | <?php /** * @author marcus */ class SimpleCacheControllerExtension extends Extension { public function onAfterInit() { if ($this->owner->NeverCache) { $this->nocacheHeaders(); } } public function nocacheHeaders() { $res = $this->owner->getResponse(); if ($res) { $current = Config::inst()->get('HTTP', 'cache_control'); $current['private'] = true; $current['no-store'] = true; Config::inst()->update('HTTP', 'cache_control', $current); $res->addHeader('X-SilverStripe-NoCache', '1'); } } } |