Merge "Added a separate error message for mkdir failures"
[lhc/web/wiklou.git] / includes / specialpage / FormSpecialPage.php
index 42c5980..66c7d47 100644 (file)
@@ -95,7 +95,7 @@ abstract class FormSpecialPage extends SpecialPage {
                        $this->getContext(),
                        $this->getMessagePrefix()
                );
-               $form->setSubmitCallback( array( $this, 'onSubmit' ) );
+               $form->setSubmitCallback( [ $this, 'onSubmit' ] );
                if ( $this->getDisplayFormat() !== 'ooui' ) {
                        // No legend and wrapper by default in OOUI forms, but can be set manually
                        // from alterForm()
@@ -107,17 +107,18 @@ abstract class FormSpecialPage extends SpecialPage {
                        $form->addHeaderText( $headerMsg->parseAsBlock() );
                }
 
-               // Retain query parameters (uselang etc)
-               $params = array_diff_key(
-                       $this->getRequest()->getQueryValues(), array( 'title' => null ) );
-               $form->addHiddenField( 'redirectparams', wfArrayToCgi( $params ) );
-
                $form->addPreText( $this->preText() );
                $form->addPostText( $this->postText() );
                $this->alterForm( $form );
+               if ( $form->getMethod() == 'post' ) {
+                       // Retain query parameters (uselang etc) on POST requests
+                       $params = array_diff_key(
+                               $this->getRequest()->getQueryValues(), [ 'title' => null ] );
+                       $form->addHiddenField( 'redirectparams', wfArrayToCgi( $params ) );
+               }
 
                // Give hooks a chance to alter the form, adding extra fields or text etc
-               Hooks::run( 'SpecialPageBeforeFormDisplay', array( $this->getName(), &$form ) );
+               Hooks::run( 'SpecialPageBeforeFormDisplay', [ $this->getName(), &$form ] );
 
                return $form;
        }
@@ -169,7 +170,6 @@ abstract class FormSpecialPage extends SpecialPage {
         * Failures here must throw subclasses of ErrorPageError.
         * @param User $user
         * @throws UserBlockedError
-        * @return bool True
         */
        protected function checkExecutePermissions( User $user ) {
                $this->checkPermissions();
@@ -182,8 +182,6 @@ abstract class FormSpecialPage extends SpecialPage {
                if ( $this->requiresWrite() ) {
                        $this->checkReadOnly();
                }
-
-               return true;
        }
 
        /**