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 "Make DBAccessBase use DBConnRef, rename $wiki, and hide getLoadBalancer()"
[lhc/web/wiklou.git]
/
includes
/
objectcache
/
ObjectCache.php
diff --git
a/includes/objectcache/ObjectCache.php
b/includes/objectcache/ObjectCache.php
index
82b760a
..
5e99ac9
100644
(file)
--- a/
includes/objectcache/ObjectCache.php
+++ b/
includes/objectcache/ObjectCache.php
@@
-119,7
+119,7
@@
class ObjectCache {
* @return BagOStuff
* @throws InvalidArgumentException
*/
* @return BagOStuff
* @throws InvalidArgumentException
*/
- p
ublic
static function newFromId( $id ) {
+ p
rivate
static function newFromId( $id ) {
global $wgObjectCaches;
if ( !isset( $wgObjectCaches[$id] ) ) {
global $wgObjectCaches;
if ( !isset( $wgObjectCaches[$id] ) ) {
@@
-146,7
+146,7
@@
class ObjectCache {
*
* @return string
*/
*
* @return string
*/
- p
ublic
static function getDefaultKeyspace() {
+ p
rivate
static function getDefaultKeyspace() {
global $wgCachePrefix;
$keyspace = $wgCachePrefix;
global $wgCachePrefix;
$keyspace = $wgCachePrefix;
@@
-178,7
+178,8
@@
class ObjectCache {
} elseif ( isset( $params['class'] ) ) {
$class = $params['class'];
// Automatically set the 'async' update handler
} elseif ( isset( $params['class'] ) ) {
$class = $params['class'];
// Automatically set the 'async' update handler
- $params['asyncHandler'] = $params['asyncHandler'] ?? 'DeferredUpdates::addCallableUpdate';
+ $params['asyncHandler'] = $params['asyncHandler']
+ ?? [ DeferredUpdates::class, 'addCallableUpdate' ];
// Enable reportDupes by default
$params['reportDupes'] = $params['reportDupes'] ?? true;
// Do b/c logic for SqlBagOStuff
// Enable reportDupes by default
$params['reportDupes'] = $params['reportDupes'] ?? true;
// Do b/c logic for SqlBagOStuff
@@
-203,9
+204,6
@@
class ObjectCache {
if ( !isset( $params['servers'] ) ) {
$params['servers'] = $GLOBALS['wgMemCachedServers'];
}
if ( !isset( $params['servers'] ) ) {
$params['servers'] = $GLOBALS['wgMemCachedServers'];
}
- if ( !isset( $params['debug'] ) ) {
- $params['debug'] = $GLOBALS['wgMemCachedDebug'];
- }
if ( !isset( $params['persistent'] ) ) {
$params['persistent'] = $GLOBALS['wgMemCachedPersistent'];
}
if ( !isset( $params['persistent'] ) ) {
$params['persistent'] = $GLOBALS['wgMemCachedPersistent'];
}
@@
-296,7
+294,7
@@
class ObjectCache {
* @return WANObjectCache
* @throws UnexpectedValueException
*/
* @return WANObjectCache
* @throws UnexpectedValueException
*/
- p
ublic
static function newWANCacheFromId( $id ) {
+ p
rivate
static function newWANCacheFromId( $id ) {
global $wgWANObjectCaches, $wgObjectCaches;
if ( !isset( $wgWANObjectCaches[$id] ) ) {
global $wgWANObjectCaches, $wgObjectCaches;
if ( !isset( $wgWANObjectCaches[$id] ) ) {
@@
-321,9
+319,10
@@
class ObjectCache {
* @param array $params
* @return WANObjectCache
* @throws UnexpectedValueException
* @param array $params
* @return WANObjectCache
* @throws UnexpectedValueException
+ * @suppress PhanTypeMismatchReturn
*/
public static function newWANCacheFromParams( array $params ) {
*/
public static function newWANCacheFromParams( array $params ) {
- global $wgCommandLineMode;
+ global $wgCommandLineMode
, $wgSecretKey
;
$services = MediaWikiServices::getInstance();
$params['cache'] = self::newFromParams( $params['store'] );
$services = MediaWikiServices::getInstance();
$params['cache'] = self::newFromParams( $params['store'] );
@@
-334,6
+333,7
@@
class ObjectCache {
// Let pre-emptive refreshes happen post-send on HTTP requests
$params['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
}
// Let pre-emptive refreshes happen post-send on HTTP requests
$params['asyncHandler'] = [ DeferredUpdates::class, 'addCallableUpdate' ];
}
+ $params['secret'] = $params['secret'] ?? $wgSecretKey;
$class = $params['class'];
return new $class( $params );
$class = $params['class'];
return new $class( $params );
@@
-359,6
+359,7
@@
class ObjectCache {
* @deprecated Since 1.28 Use MediaWikiServices::getInstance()->getMainWANObjectCache()
*/
public static function getMainWANInstance() {
* @deprecated Since 1.28 Use MediaWikiServices::getInstance()->getMainWANObjectCache()
*/
public static function getMainWANInstance() {
+ wfDeprecated( __METHOD__, '1.28' );
return MediaWikiServices::getInstance()->getMainWANObjectCache();
}
return MediaWikiServices::getInstance()->getMainWANObjectCache();
}
@@
-390,12
+391,19
@@
class ObjectCache {
*/
public static function detectLocalServerCache() {
if ( function_exists( 'apcu_fetch' ) ) {
*/
public static function detectLocalServerCache() {
if ( function_exists( 'apcu_fetch' ) ) {
- return 'apcu';
+ // Make sure the APCu methods actually store anything
+ if ( PHP_SAPI !== 'cli' || ini_get( 'apc.enable_cli' ) ) {
+ return 'apcu';
+ }
} elseif ( function_exists( 'apc_fetch' ) ) {
} elseif ( function_exists( 'apc_fetch' ) ) {
- return 'apc';
+ // Make sure the APC methods actually store anything
+ if ( PHP_SAPI !== 'cli' || ini_get( 'apc.enable_cli' ) ) {
+ return 'apc';
+ }
} elseif ( function_exists( 'wincache_ucache_get' ) ) {
return 'wincache';
}
} elseif ( function_exists( 'wincache_ucache_get' ) ) {
return 'wincache';
}
+
return CACHE_NONE;
}
}
return CACHE_NONE;
}
}