jenkins-bot has submitted this change and it was merged.
Change subject: objectcache: Use newAccelerator() fallback instead of try/catch
......................................................................
objectcache: Use newAccelerator() fallback instead of try/catch
Also remove confusing use of $wgMemc in LoadMonitorMySQL which
should always be the same as wfGetMainCache().
Change-Id: I4fb9d075a37d3d45af71a5026ccf2eb17f24d7b0
---
M includes/db/LoadMonitorMySQL.php
M includes/filebackend/SwiftFileBackend.php
M includes/utils/MWCryptHKDF.php
3 files changed, 7 insertions(+), 14 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/db/LoadMonitorMySQL.php b/includes/db/LoadMonitorMySQL.php
index 752d009..3008419 100644
--- a/includes/db/LoadMonitorMySQL.php
+++ b/includes/db/LoadMonitorMySQL.php
@@ -34,12 +34,10 @@
protected $mainCache;
public function __construct( $parent ) {
- global $wgMemc;
-
$this->parent = $parent;
$this->srvCache = ObjectCache::newAccelerator( 'hash' );
- $this->mainCache = $wgMemc ?: wfGetMainCache();
+ $this->mainCache = wfGetMainCache();
}
public function scaleLoads( &$loads, $group = false, $wiki = false ) {
diff --git a/includes/filebackend/SwiftFileBackend.php
b/includes/filebackend/SwiftFileBackend.php
index b49c4c5..e0a08b2 100644
--- a/includes/filebackend/SwiftFileBackend.php
+++ b/includes/filebackend/SwiftFileBackend.php
@@ -138,13 +138,12 @@
if ( PHP_SAPI === 'cli' ) {
$this->srvCache = wfGetMainCache(); //
preferrably memcached
} else {
- try { // look for APC, XCache, WinCache, ect...
- $this->srvCache =
ObjectCache::newAccelerator();
- } catch ( Exception $e ) {
- }
+ // look for APC, XCache, WinCache, ect...
+ $this->srvCache = ObjectCache::newAccelerator(
CACHE_NONE );
}
+ } else {
+ $this->srvCache = new EmptyBagOStuff();
}
- $this->srvCache = $this->srvCache ?: new EmptyBagOStuff();
}
public function getFeatures() {
diff --git a/includes/utils/MWCryptHKDF.php b/includes/utils/MWCryptHKDF.php
index 1ddd119..740df92 100644
--- a/includes/utils/MWCryptHKDF.php
+++ b/includes/utils/MWCryptHKDF.php
@@ -161,7 +161,7 @@
* @throws MWException
*/
protected static function singleton() {
- global $wgHKDFAlgorithm, $wgHKDFSecret, $wgSecretKey;
+ global $wgHKDFAlgorithm, $wgHKDFSecret, $wgSecretKey,
$wgMainCacheType;
$secret = $wgHKDFSecret ?: $wgSecretKey;
if ( !$secret ) {
@@ -176,11 +176,7 @@
$context[] = gethostname();
// Setup salt cache. Use APC, or fallback to the main cache if
it isn't setup
- try {
- $cache = ObjectCache::newAccelerator();
- } catch ( Exception $e ) {
- $cache = wfGetMainCache();
- }
+ $cache = ObjectCache::newAccelerator( $wgMainCacheType );
if ( is_null( self::$singleton ) ) {
self::$singleton = new self( $secret, $wgHKDFAlgorithm,
$cache, $context );
--
To view, visit https://gerrit.wikimedia.org/r/233613
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4fb9d075a37d3d45af71a5026ccf2eb17f24d7b0
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits