Follow-up r86041: fix redirect in PurgeAction, and pass query parameters through...
authorHappy-melon <happy-melon@users.mediawiki.org>
Fri, 15 Apr 2011 22:11:33 +0000 (22:11 +0000)
committerHappy-melon <happy-melon@users.mediawiki.org>
Fri, 15 Apr 2011 22:11:33 +0000 (22:11 +0000)
includes/Action.php
includes/actions/PurgeAction.php

index 9f35e6a..5fbb5c7 100644 (file)
@@ -285,7 +285,14 @@ abstract class FormAction extends Action {
 
                $form = new HTMLForm( $this->fields, $this->getContext() );
                $form->setSubmitCallback( array( $this, 'onSubmit' ) );
-               $form->addHiddenField( 'action', $this->getName() );
+
+               // Retain query parameters (uselang etc)
+               $form->addHiddenField( 'action', $this->getName() ); // Might not be the same as the query string
+               $params = array_diff_key(
+                       $this->getRequest()->getQueryValues(),
+                       array( 'action' => null, 'title' => null )
+               );
+               $form->addHiddenField( 'redirectparams', wfArrayToCGI( $params ) );
 
                $form->addPreText( $this->preText() );
                $form->addPostText( $this->postText() );
index 595580d..3f54b81 100644 (file)
@@ -88,6 +88,6 @@ class PurgeAction extends FormAction {
        }
 
        public function onSuccess() {
-               $this->getOutput()->redirect( $this->getTitle() );
+               $this->getOutput()->redirect( $this->getTitle()->getFullUrl( $this->getRequest()->getVal( 'redirectparams', '' ) ) );
        }
 }