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 "Branch ArticleCreationWorkflow" into wmf/1.30.0-wmf.17
[lhc/web/wiklou.git]
/
includes
/
cache
/
CacheHelper.php
diff --git
a/includes/cache/CacheHelper.php
b/includes/cache/CacheHelper.php
index
401c2b9
..
8c70be2
100644
(file)
--- a/
includes/cache/CacheHelper.php
+++ b/
includes/cache/CacheHelper.php
@@
-61,7
+61,7
@@
interface ICacheHelper {
*
* @return mixed
*/
*
* @return mixed
*/
- function getCachedValue( $computeFunction, $args =
array()
, $key = null );
+ function getCachedValue( $computeFunction, $args =
[]
, $key = null );
/**
* Saves the HTML to the cache in case it got recomputed.
/**
* Saves the HTML to the cache in case it got recomputed.
@@
-82,6
+82,8
@@
interface ICacheHelper {
function setExpiry( $cacheExpiry );
}
function setExpiry( $cacheExpiry );
}
+use MediaWiki\MediaWikiServices;
+
/**
* Helper class for caching various elements in a single cache entry.
*
/**
* Helper class for caching various elements in a single cache entry.
*
@@
-150,7
+152,7
@@
class CacheHelper implements ICacheHelper {
* @since 1.20
* @var array
*/
* @since 1.20
* @var array
*/
- protected $cacheKey =
array()
;
+ protected $cacheKey =
[]
;
/**
* Sets if the cache should be enabled or not.
/**
* Sets if the cache should be enabled or not.
@@
-217,10
+219,10
@@
class CacheHelper implements ICacheHelper {
$subPage = explode( '/', $subPage, 2 );
$subPage = count( $subPage ) > 1 ? $subPage[1] : false;
$subPage = explode( '/', $subPage, 2 );
$subPage = count( $subPage ) > 1 ? $subPage[1] : false;
- $message .= ' ' .
Linker::l
ink(
+ $message .= ' ' .
MediaWikiServices::getInstance()->getLinkRenderer()->makeL
ink(
$context->getTitle( $subPage ),
$context->getTitle( $subPage ),
- $context->msg( 'cachedspecial-refresh-now' )->
escaped
(),
-
array()
,
+ $context->msg( 'cachedspecial-refresh-now' )->
text
(),
+
[]
,
$refreshArgs
);
}
$refreshArgs
);
}
@@
-239,7
+241,7
@@
class CacheHelper implements ICacheHelper {
$cachedChunks = wfGetCache( CACHE_ANYTHING )->get( $this->getCacheKeyString() );
$this->hasCached = is_array( $cachedChunks );
$cachedChunks = wfGetCache( CACHE_ANYTHING )->get( $this->getCacheKeyString() );
$this->hasCached = is_array( $cachedChunks );
- $this->cachedChunks = $this->hasCached ? $cachedChunks :
array()
;
+ $this->cachedChunks = $this->hasCached ? $cachedChunks :
[]
;
if ( $this->onInitHandler !== false ) {
call_user_func( $this->onInitHandler, $this->hasCached );
if ( $this->onInitHandler !== false ) {
call_user_func( $this->onInitHandler, $this->hasCached );
@@
-261,7
+263,7
@@
class CacheHelper implements ICacheHelper {
*
* @return mixed
*/
*
* @return mixed
*/
- public function getCachedValue( $computeFunction, $args =
array()
, $key = null ) {
+ public function getCachedValue( $computeFunction, $args =
[]
, $key = null ) {
$this->initCaching();
if ( $this->cacheEnabled && $this->hasCached ) {
$this->initCaching();
if ( $this->cacheEnabled && $this->hasCached ) {
@@
-289,7
+291,7
@@
class CacheHelper implements ICacheHelper {
}
} else {
if ( !is_array( $args ) ) {
}
} else {
if ( !is_array( $args ) ) {
- $args =
array( $args )
;
+ $args =
[ $args ]
;
}
$value = call_user_func_array( $computeFunction, $args );
}
$value = call_user_func_array( $computeFunction, $args );
@@
-344,7
+346,7
@@
class CacheHelper implements ICacheHelper {
* @throws MWException
*/
protected function getCacheKeyString() {
* @throws MWException
*/
protected function getCacheKeyString() {
- if ( $this->cacheKey ===
array()
) {
+ if ( $this->cacheKey ===
[]
) {
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.' );
}