From: Aaron Schulz Date: Thu, 14 Apr 2016 23:22:54 +0000 (-0700) Subject: Avoid DBPerformance log warnings in SpecialPreferences X-Git-Tag: 1.31.0-rc.0~7285^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles_versions%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=d27042fd253d9e5440fb7a8987a8d09553fa877e;p=lhc%2Fweb%2Fwiklou.git Avoid DBPerformance log warnings in SpecialPreferences Preference views do not need the master DB. Change-Id: Id0c3fc6d453b6af0eca8450107da6d554c822347 --- diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index 7f257e65e4..2e7b4cd2d2 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -74,7 +74,11 @@ class SpecialPreferences extends SpecialPage { $this->addHelpLink( 'Help:Preferences' ); // Load the user from the master to reduce CAS errors on double post (T95839) - $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser(); + if ( $this->getRequest()->wasPosted() ) { + $user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser(); + } else { + $user = $this->getUser(); + } $htmlForm = Preferences::getFormObject( $user, $this->getContext() ); $htmlForm->setSubmitCallback( [ 'Preferences', 'tryUISubmit' ] );