Merge branch '3.2' into 3
This commit is contained in:
commit
3d8d3ec28c
|
@ -9,7 +9,7 @@ use SilverStripe\Core\Config\Config;
|
||||||
*/
|
*/
|
||||||
class CachedContentFilter extends ContentFilter
|
class CachedContentFilter extends ContentFilter
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable caching
|
* Enable caching
|
||||||
*
|
*
|
||||||
|
@ -17,20 +17,20 @@ class CachedContentFilter extends ContentFilter
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
private static $cache_enabled = true;
|
private static $cache_enabled = true;
|
||||||
|
|
||||||
public function getContent($key, $callback)
|
public function getContent($key, $callback)
|
||||||
{
|
{
|
||||||
$cache = $this->getCache();
|
$cache = $this->getCache();
|
||||||
|
|
||||||
// Return cached value if available
|
// Return cached value if available
|
||||||
$cacheEnabled = Config::inst()->get(get_class(), 'cache_enabled');
|
$cacheEnabled = Config::inst()->get(self::class, 'cache_enabled');
|
||||||
$result = (isset($_GET['flush']) || !$cacheEnabled)
|
$result = (isset($_GET['flush']) || !$cacheEnabled)
|
||||||
? null
|
? null
|
||||||
: $cache->get($key);
|
: $cache->get($key);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to generate result
|
// Fallback to generate result
|
||||||
$result = parent::getContent($key, $callback);
|
$result = parent::getContent($key, $callback);
|
||||||
$lifetime = Config::inst()->get(ContentFilter::class, 'cache_lifetime') ?: null;
|
$lifetime = Config::inst()->get(ContentFilter::class, 'cache_lifetime') ?: null;
|
||||||
|
|
|
@ -206,7 +206,7 @@ class VersionFeed extends SiteTreeExtension
|
||||||
|
|
||||||
public function getSiteRSSLink()
|
public function getSiteRSSLink()
|
||||||
{
|
{
|
||||||
if (Config::inst()->get(get_class(), 'allchanges_enabled')
|
if (Config::inst()->get(self::class, 'allchanges_enabled')
|
||||||
&& SiteConfig::current_site_config()->AllChangesEnabled
|
&& SiteConfig::current_site_config()->AllChangesEnabled
|
||||||
) {
|
) {
|
||||||
return $this->owner->Link('allchanges');
|
return $this->owner->Link('allchanges');
|
||||||
|
@ -215,7 +215,7 @@ class VersionFeed extends SiteTreeExtension
|
||||||
|
|
||||||
public function getDefaultRSSLink()
|
public function getDefaultRSSLink()
|
||||||
{
|
{
|
||||||
if (Config::inst()->get(get_class(), 'changes_enabled') && $this->owner->PublicHistory) {
|
if (Config::inst()->get(self::class, 'changes_enabled') && $this->owner->PublicHistory) {
|
||||||
return $this->owner->Link('changes');
|
return $this->owner->Link('changes');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue