X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FCacheHelper.php;h=f0ae5a313faa46c6d8c6519adba2b4cba5deb129;hb=860878789796ebf5edcd50a3864e4fa1d214a391;hp=8199cb4a4b188fd6228ce22ca8f1ed9c7d631bd1;hpb=558480e3ed462cd20ddc8b5fc8245bfd7b831772;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/CacheHelper.php b/includes/CacheHelper.php index 8199cb4a4b..f0ae5a313f 100644 --- a/includes/CacheHelper.php +++ b/includes/CacheHelper.php @@ -18,7 +18,7 @@ * http://www.gnu.org/copyleft/gpl.html * * @file - * @licence GNU GPL v2 or later + * @license GNU GPL v2 or later * @author Jeroen De Dauw < jeroendedauw@gmail.com > */ @@ -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 ); }