X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiOptions.php;h=a62bcb6d56087ebed20936a9006d4e80f62f0b1c;hb=c0ee3dd1d906e735fddccdc6754e00ea35844146;hp=436f22aee5d285d2ffaa5e31103c6f12189615d1;hpb=6989663bbc53c59e0f931a9f112798ea9cccd5e4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index 436f22aee5..a62bcb6d56 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -52,6 +52,14 @@ class ApiOptions extends ApiBase { $this->dieUsageMsg( array( 'missingparam', 'optionname' ) ); } + // 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 ) ) { + $this->dieUsage( 'Anonymous users cannot change preferences', 'notloggedin' ); + } + } + if ( $params['reset'] ) { $user->resetOptions( $params['resetkinds'], $this->getContext() ); $changed = true;