From d27042fd253d9e5440fb7a8987a8d09553fa877e Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 14 Apr 2016 16:22:54 -0700 Subject: [PATCH] Avoid DBPerformance log warnings in SpecialPreferences Preference views do not need the master DB. Change-Id: Id0c3fc6d453b6af0eca8450107da6d554c822347 --- includes/specials/SpecialPreferences.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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' ] ); -- 2.20.1