Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/284826
Change subject: Avoid incorrectly setting mFromMaster to true
......................................................................
Avoid incorrectly setting mFromMaster to true
Cache loads should not set this. It can make further queries
use DB_MASTER.
Bug: T92357
Change-Id: I370e3ba0a3525ad68138b609454b3e82e54274d2
---
M includes/CentralAuthUser.php
1 file changed, 9 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth
refs/changes/26/284826/1
diff --git a/includes/CentralAuthUser.php b/includes/CentralAuthUser.php
index f3adc27..e927554 100644
--- a/includes/CentralAuthUser.php
+++ b/includes/CentralAuthUser.php
@@ -204,7 +204,9 @@
* @throws CentralAuthReadOnlyError
*/
protected function getSafeReadDB() {
- return $this->shouldUseMasterDB() ?
CentralAuthUtils::getCentralDB() : CentralAuthUtils::getCentralSlaveDB();
+ return $this->shouldUseMasterDB()
+ ? CentralAuthUtils::getCentralDB()
+ : CentralAuthUtils::getCentralSlaveDB();
}
/**
@@ -458,14 +460,12 @@
/**
* Load data from memcached
*
- * @param $cache Array
- * @param $fromMaster Bool
+ * @param $cache array
* @return bool
*/
- protected function loadFromCache( $cache = null, $fromMaster = false ) {
+ protected function loadFromCache( $cache = null ) {
if ( $cache == null ) {
$cache = ObjectCache::getMainWANInstance()->get(
$this->getCacheKey() );
- $fromMaster = true;
}
if ( !is_array( $cache ) || $cache['mVersion'] <
$this->mVersion ) {
@@ -475,7 +475,7 @@
return false;
}
- $this->loadFromCacheObject( $cache, $fromMaster );
+ $this->loadFromCacheObject( $cache );
return true;
}
@@ -483,10 +483,9 @@
/**
* Load user state from a cached array.
*
- * @param $object Array
- * @param $fromMaster Bool
+ * @param $object array
*/
- protected function loadFromCacheObject( $object, $fromMaster = false ) {
+ protected function loadFromCacheObject( $object ) {
wfDebugLog( 'CentralAuthVerbose', "Loading CentralAuthUser for
user {$this->mName} from cache object" );
foreach ( self::$mCacheVars as $var ) {
$this->$var = $object[$var];
@@ -495,7 +494,7 @@
$this->loadAttached();
$this->mIsAttached = $this->exists() && in_array( wfWikiID(),
$this->mAttachedArray );
- $this->mFromMaster = $fromMaster;
+ $this->mFromMaster = false;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/284826
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I370e3ba0a3525ad68138b609454b3e82e54274d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits