From: Aaron Schulz Date: Thu, 16 Apr 2015 17:54:26 +0000 (-0700) Subject: Made saveSettings() CAS check handle caught DB exceptions better X-Git-Tag: 1.31.0-rc.0~11683^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22upgrade%22%2C%22reinstall=non%22%29%20.%20%22?a=commitdiff_plain;h=28404fad368d2c363b2c76b1dccc5460aa34dfc1;p=lhc%2Fweb%2Fwiklou.git Made saveSettings() CAS check handle caught DB exceptions better Change-Id: I8e9e75af437e00a76e4184908c579a6702c9023a --- diff --git a/includes/User.php b/includes/User.php index 59d5c03cf8..b122a9fd96 100644 --- a/includes/User.php +++ b/includes/User.php @@ -3603,7 +3603,7 @@ class User implements IDBAccessObject { // This will be used for a CAS check as a last-resort safety // check against race conditions and slave lag. $oldTouched = $this->mTouched; - $this->mTouched = $this->newTouchedTimestamp(); + $newTouched = $this->newTouchedTimestamp(); if ( !$wgAuth->allowSetLocalPassword() ) { $this->mPassword = self::getPasswordFactory()->newFromCiphertext( null ); @@ -3619,7 +3619,7 @@ class User implements IDBAccessObject { 'user_real_name' => $this->mRealName, 'user_email' => $this->mEmail, 'user_email_authenticated' => $dbw->timestampOrNull( $this->mEmailAuthenticated ), - 'user_touched' => $dbw->timestamp( $this->mTouched ), + 'user_touched' => $dbw->timestamp( $newTouched ), 'user_token' => strval( $this->mToken ), 'user_email_token' => $this->mEmailToken, 'user_email_token_expires' => $dbw->timestampOrNull( $this->mEmailTokenExpires ), @@ -3631,17 +3631,18 @@ class User implements IDBAccessObject { ); if ( !$dbw->affectedRows() ) { + // Maybe the problem was a missed cache update; clear it to be safe + $this->clearSharedCache(); // User was changed in the meantime or loaded with stale data MWExceptionHandler::logException( new MWException( "CAS update failed on user_touched for user ID '{$this->mId}';" . "the version of the user to be saved is older than the current version." ) ); - // Maybe the problem was a missed cache update; clear it to be safe - $this->clearSharedCache(); return; } + $this->mTouched = $newTouched; $this->saveOptions(); Hooks::run( 'UserSaveSettings', array( $this ) );