Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/240968
Change subject: Avoid CAS errors on double post to ApiOptions ...................................................................... Avoid CAS errors on double post to ApiOptions Bug: T95839 Change-Id: I62f8eea31164be1ab0eacf31c494f0b296b367f2 --- M includes/User.php M includes/api/ApiOptions.php 2 files changed, 4 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/68/240968/1 diff --git a/includes/User.php b/includes/User.php index d57dfaa..31d3a99 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1203,18 +1203,15 @@ return false; } - $db = ( $flags & self::READ_LATEST ) - ? wfGetDB( DB_MASTER ) - : wfGetDB( DB_SLAVE ); + list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags ); + $db = wfGetDB( $index ); $s = $db->selectRow( 'user', self::selectFields(), array( 'user_id' => $this->mId ), __METHOD__, - ( ( $flags & self::READ_LOCKING ) == self::READ_LOCKING ) - ? array( 'LOCK IN SHARE MODE' ) - : array() + $options ); $this->queryFlagsUsed = $flags; diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index a62bcb6..74ce053 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -55,7 +55,7 @@ // Load the user from the master to reduce CAS errors on double post (T95839) if ( wfGetLB()->getServerCount() > 1 ) { $user = User::newFromId( $user->getId() ); - if ( !$user->loadFromId( User::READ_LATEST ) ) { + if ( !$user->loadFromId( User::READ_EXCLUSIVE ) ) { $this->dieUsage( 'Anonymous users cannot change preferences', 'notloggedin' ); } } -- To view, visit https://gerrit.wikimedia.org/r/240968 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62f8eea31164be1ab0eacf31c494f0b296b367f2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits