From: jeroendedauw Date: Tue, 4 Sep 2012 13:37:24 +0000 (+0200) Subject: Added missing field definition, added cache key check and fixed type hint X-Git-Tag: 1.31.0-rc.0~22473^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=7f3a4d5ab5a56e55e5c99a6a4cd9f9d9d31ef9a6;p=lhc%2Fweb%2Fwiklou.git Added missing field definition, added cache key check and fixed type hint Change-Id: I60a6bc22175f9187cafbd9daebe1dfb7d2b1d0fd --- diff --git a/includes/CacheHelper.php b/includes/CacheHelper.php index 8199cb4a4b..ac46fc4260 100644 --- a/includes/CacheHelper.php +++ b/includes/CacheHelper.php @@ -143,10 +143,18 @@ class CacheHelper implements ICacheHelper { * Function that gets called when initialization is done. * * @since 1.20 - * @var function + * @var callable */ protected $onInitHandler = false; + /** + * Elements to build a cache key with. + * + * @since 1.20 + * @var array + */ + protected $cacheKey = array(); + /** * Sets if the cache should be enabled or not. * @@ -338,8 +346,13 @@ class CacheHelper implements ICacheHelper { * @since 1.20 * * @return string + * @throws MWException */ protected function getCacheKeyString() { + if ( $this->cacheKey === array() ) { + throw new MWException( 'No cache key set, so cannot obtain or save the CacheHelper values.' ); + } + return call_user_func_array( 'wfMemcKey', $this->cacheKey ); }