From c94d9162fcf544d94052654b414d0249861c9695 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Tue, 20 Mar 2012 00:31:10 +0000 Subject: [PATCH] added enabled field so you can disable the cache thing if you need to before its been initialized and fixed copypaste error --- includes/actions/CachedAction.php | 11 ++++++++++- includes/specials/SpecialCachedPage.php | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/includes/actions/CachedAction.php b/includes/actions/CachedAction.php index 5a2264a0cd..300a93ddf9 100644 --- a/includes/actions/CachedAction.php +++ b/includes/actions/CachedAction.php @@ -36,6 +36,14 @@ abstract class CachedAction extends FormlessAction implements ICacheHelper { */ protected $cacheHelper; + /** + * If the cache is enabled or not. + * + * @since 1.20 + * @var boolean + */ + protected $cacheEnabled = true; + /** * Sets if the cache should be enabled or not. * @@ -56,8 +64,9 @@ abstract class CachedAction extends FormlessAction implements ICacheHelper { * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. */ public function startCache( $cacheExpiry = null, $cacheEnabled = null ) { - $this->cacheHelper = new CacheHelper( $this->get ); + $this->cacheHelper = new CacheHelper(); + $this->cacheHelper->setCacheEnabled( $this->cacheEnabled ); $this->cacheHelper->setOnInitializedHandler( array( $this, 'onCacheInitialized' ) ); $keyArgs = $this->getCacheKey(); diff --git a/includes/specials/SpecialCachedPage.php b/includes/specials/SpecialCachedPage.php index eb8e6b9d0c..6c484344f6 100644 --- a/includes/specials/SpecialCachedPage.php +++ b/includes/specials/SpecialCachedPage.php @@ -36,6 +36,14 @@ abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper { */ protected $cacheHelper; + /** + * If the cache is enabled or not. + * + * @since 1.20 + * @var boolean + */ + protected $cacheEnabled = true; + /** * Sets if the cache should be enabled or not. * @@ -56,8 +64,9 @@ abstract class SpecialCachedPage extends SpecialPage implements ICacheHelper { * @param boolean|null $cacheEnabled Sets if the cache should be enabled or not. */ public function startCache( $cacheExpiry = null, $cacheEnabled = null ) { - $this->cacheHelper = new CacheHelper( $this->get ); + $this->cacheHelper = new CacheHelper(); + $this->cacheHelper->setCacheEnabled( $this->cacheEnabled ); $this->cacheHelper->setOnInitializedHandler( array( $this, 'onCacheInitialized' ) ); $keyArgs = $this->getCacheKey(); -- 2.20.1