Samwilson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/404625 )

Change subject: Override now-protected showResetForm() rather than 
re-implementing
......................................................................

Override now-protected showResetForm() rather than re-implementing

The parent method used to be private, but is now protected, and
so we can clean some things up here. It's still duplicating code,
but it's less than before.

Change-Id: If9dbdd78c2818483c76e92fe70fe9b4a2b7c9fa5
---
M includes/SpecialGlobalPreferences.php
1 file changed, 2 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GlobalPreferences 
refs/changes/25/404625/1

diff --git a/includes/SpecialGlobalPreferences.php 
b/includes/SpecialGlobalPreferences.php
index 204623c..4bb4920 100644
--- a/includes/SpecialGlobalPreferences.php
+++ b/includes/SpecialGlobalPreferences.php
@@ -27,12 +27,6 @@
         * @throws UserNotLoggedIn
         */
        public function execute( $par ) {
-               // Because parent::showResetForm() is private, we have to 
override it separately here.
-               if ( $par == 'reset' ) {
-                       $this->showGlobalPrefsResetForm();
-                       return;
-               }
-
                // Dirty override to check user can set global prefs.
                if ( $this->getUser()->isAnon() ) {
                        // @todo use our own error messages here
@@ -76,23 +70,13 @@
 
        /**
         * Display the preferences-reset confirmation page.
-        * This mostly repeats code in parent::execute() and 
parent::showResetForm().
+        * This is identical to parent::showResetForm except with the message 
names changed.
         * @throws PermissionsError
         */
-       protected function showGlobalPrefsResetForm() {
+       protected function showResetForm() {
                if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) {
                        throw new PermissionsError( 'editmyoptions' );
                }
-
-               // This section is duplicated from parent::execute().
-               $this->setHeaders();
-               $this->outputHeader();
-               $out = $this->getOutput();
-               // Prevent hijacked user scripts from sniffing passwords etc.
-               $out->disallowUserJs();
-               // Use the same message as normal Preferences for the 
login-redirection message.
-               $this->requireLogin( 'prefsnologintext2' );
-               $this->checkReadOnly();
 
                $this->getOutput()->addWikiMsg( 'globalprefs-reset-intro' );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/404625
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If9dbdd78c2818483c76e92fe70fe9b4a2b7c9fa5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GlobalPreferences
Gerrit-Branch: master
Gerrit-Owner: Samwilson <s...@samwilson.id.au>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to