dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Use IDatabase::buildStringCast in Special:MediaStatistics"
[lhc/web/wiklou.git]
/
includes
/
cache
/
CacheHelper.php
diff --git
a/includes/cache/CacheHelper.php
b/includes/cache/CacheHelper.php
index
d7669eb
..
d1261a8
100644
(file)
--- a/
includes/cache/CacheHelper.php
+++ b/
includes/cache/CacheHelper.php
@@
-82,9
+82,9
@@
class CacheHelper implements ICacheHelper {
* Function that gets called when initialization is done.
*
* @since 1.20
* Function that gets called when initialization is done.
*
* @since 1.20
- * @var callable
+ * @var callable
|null
*/
*/
- protected $onInitHandler
= false
;
+ protected $onInitHandler;
/**
* Elements to build a cache key with.
/**
* Elements to build a cache key with.
@@
-183,7
+183,7
@@
class CacheHelper implements ICacheHelper {
$this->hasCached = is_array( $cachedChunks );
$this->cachedChunks = $this->hasCached ? $cachedChunks : [];
$this->hasCached = is_array( $cachedChunks );
$this->cachedChunks = $this->hasCached ? $cachedChunks : [];
- if ( $this->onInitHandler !==
false
) {
+ if ( $this->onInitHandler !==
null
) {
call_user_func( $this->onInitHandler, $this->hasCached );
}
}
call_user_func( $this->onInitHandler, $this->hasCached );
}
}
@@
-221,13
+221,11
@@
class CacheHelper implements ICacheHelper {
} else {
$value = array_shift( $this->cachedChunks );
}
} else {
$value = array_shift( $this->cachedChunks );
}
+ } elseif ( array_key_exists( $key, $this->cachedChunks ) ) {
+ $value = $this->cachedChunks[$key];
+ unset( $this->cachedChunks[$key] );
} else {
} else {
- if ( array_key_exists( $key, $this->cachedChunks ) ) {
- $value = $this->cachedChunks[$key];
- unset( $this->cachedChunks[$key] );
- } else {
- wfWarn( "There is no item with key '$key' in this->cachedChunks in " . __METHOD__ );
- }
+ wfWarn( "There is no item with key '$key' in this->cachedChunks in " . __METHOD__ );
}
} else {
if ( !is_array( $args ) ) {
}
} else {
if ( !is_array( $args ) ) {
@@
-290,7
+288,9
@@
class CacheHelper implements ICacheHelper {
throw new MWException( 'No cache key set, so cannot obtain or save the CacheHelper values.' );
}
throw new MWException( 'No cache key set, so cannot obtain or save the CacheHelper values.' );
}
- return wfMemcKey( ...array_values( $this->cacheKey ) );
+ return ObjectCache::getLocalClusterInstance()->makeKey(
+ ...array_values( $this->cacheKey )
+ );
}
/**
}
/**