Remove calls to deprecated HTMLForm#setTitle
authorBartosz Dziewoński <matma.rex@gmail.com>
Fri, 27 Sep 2013 20:52:44 +0000 (22:52 +0200)
committerReedy <reedy@wikimedia.org>
Sun, 13 Oct 2013 21:17:35 +0000 (22:17 +0100)
Use DerivativeContext with modified title instead.

Most of those should be using FormSpecialPage…

Change-Id: Ia66f3b4b22866cc4ac4ac7b1f2fc2a4b1a9e73f6

includes/specials/SpecialBlockList.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialEmailuser.php
includes/specials/SpecialNewimages.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialUpload.php
includes/specials/SpecialUploadStash.php

index 784ad04..f1992c0 100644 (file)
@@ -96,8 +96,9 @@ class SpecialBlockList extends SpecialPage {
                                'default' => 50,
                        ),
                );
-               $form = new HTMLForm( $fields, $this->getContext() );
-               $form->setTitle( $this->getTitle() ); // Remove subpage
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle() ); // Remove subpage
+               $form = new HTMLForm( $fields, $context );
                $form->setMethod( 'get' );
                $form->setWrapperLegendMsg( 'ipblocklist-legend' );
                $form->setSubmitTextMsg( 'ipblocklist-submit' );
index b6005de..501552e 100644 (file)
@@ -547,8 +547,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                        $this->toc = false;
                }
 
-               $form = new EditWatchlistNormalHTMLForm( $fields, $this->getContext() );
-               $form->setTitle( $this->getTitle() );
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle() ); // Remove subpage
+               $form = new EditWatchlistNormalHTMLForm( $fields, $context );
                $form->setSubmitTextMsg( 'watchlistedit-normal-submit' );
                # Used message keys: 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit'
                $form->setSubmitTooltip( 'watchlistedit-normal-submit' );
@@ -610,8 +611,9 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                                'default' => $titles,
                        ),
                );
-               $form = new HTMLForm( $fields, $this->getContext() );
-               $form->setTitle( $this->getTitle( 'raw' ) );
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle( 'raw' ) ); // Reset subpage
+               $form = new HTMLForm( $fields, $context );
                $form->setSubmitTextMsg( 'watchlistedit-raw-submit' );
                # Used message keys: 'accesskey-watchlistedit-raw-submit', 'tooltip-watchlistedit-raw-submit'
                $form->setSubmitTooltip( 'watchlistedit-raw-submit' );
index 27188c3..2e90d99 100644 (file)
@@ -148,11 +148,12 @@ class SpecialEmailUser extends UnlistedSpecialPage {
 
                $this->mTargetObj = $ret;
 
-               $form = new HTMLForm( $this->getFormFields(), $this->getContext() );
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle() ); // Remove subpage
+               $form = new HTMLForm( $this->getFormFields(), $context );
                // By now we are supposed to be sure that $this->mTarget is a user name
                $form->addPreText( $this->msg( 'emailpagetext', $this->mTarget )->parse() );
                $form->setSubmitTextMsg( 'emailsend' );
-               $form->setTitle( $this->getTitle() );
                $form->setSubmitCallback( array( __CLASS__, 'uiSubmit' ) );
                $form->setWrapperLegendMsg( 'email-legend' );
                $form->loadData();
index 814e213..37d2973 100644 (file)
@@ -181,8 +181,9 @@ class NewFilesPager extends ReverseChronologicalPager {
                        unset( $fields['like'] );
                }
 
-               $form = new HTMLForm( $fields, $this->getContext() );
-               $form->setTitle( $this->getTitle() );
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle() ); // Remove subpage
+               $form = new HTMLForm( $fields, $context );
                $form->setSubmitTextMsg( 'ilsubmit' );
                $form->setMethod( 'get' );
                $form->setWrapperLegendMsg( 'newimages-legend' );
index cc7b8fa..ce7a45b 100644 (file)
@@ -75,10 +75,11 @@ class SpecialPreferences extends SpecialPage {
 
                $this->getOutput()->addWikiMsg( 'prefs-reset-intro' );
 
-               $htmlForm = new HTMLForm( array(), $this->getContext(), 'prefs-restore' );
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle( 'reset' ) ); // Reset subpage
+               $htmlForm = new HTMLForm( array(), $context, 'prefs-restore' );
 
                $htmlForm->setSubmitTextMsg( 'restoreprefs' );
-               $htmlForm->setTitle( $this->getTitle( 'reset' ) );
                $htmlForm->setSubmitCallback( array( $this, 'submitReset' ) );
                $htmlForm->suppressReset();
 
index 51a0a86..09facf4 100644 (file)
@@ -221,6 +221,8 @@ class SpecialUpload extends SpecialPage {
         */
        protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) {
                # Initialize form
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle() ); // Remove subpage
                $form = new UploadForm( array(
                        'watch' => $this->getWatchCheck(),
                        'forreupload' => $this->mForReUpload,
@@ -232,8 +234,7 @@ class SpecialUpload extends SpecialPage {
                        'texttop' => $this->uploadFormTextTop,
                        'textaftersummary' => $this->uploadFormTextAfterSummary,
                        'destfile' => $this->mDesiredDestName,
-               ), $this->getContext() );
-               $form->setTitle( $this->getTitle() );
+               ), $context );
 
                # Check the token, but only if necessary
                if (
index 002e949..87b6442 100644 (file)
@@ -343,15 +343,16 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                // create the form, which will also be used to execute a callback to process incoming form data
                // this design is extremely dubious, but supposedly HTMLForm is our standard now?
 
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( $this->getTitle() ); // Remove subpage
                $form = new HTMLForm( array(
                        'Clear' => array(
                                'type' => 'hidden',
                                'default' => true,
                                'name' => 'clear',
                        )
-               ), $this->getContext(), 'clearStashedUploads' );
+               ), $context, 'clearStashedUploads' );
                $form->setSubmitCallback( array( __CLASS__, 'tryClearStashedUploads' ) );
-               $form->setTitle( $this->getTitle() );
                $form->setSubmitTextMsg( 'uploadstash-clear' );
 
                $form->prepareForm();