From b71927823e7f38bcaa2a098cbc09b82f2e62e54d Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Fri, 15 Apr 2011 22:11:33 +0000 Subject: [PATCH] Follow-up r86041: fix redirect in PurgeAction, and pass query parameters through the form so they can be put back on to the redirect at the end. --- includes/Action.php | 9 ++++++++- includes/actions/PurgeAction.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index 9f35e6a4ea..5fbb5c7013 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -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() ); diff --git a/includes/actions/PurgeAction.php b/includes/actions/PurgeAction.php index 595580d920..3f54b81b6b 100644 --- a/includes/actions/PurgeAction.php +++ b/includes/actions/PurgeAction.php @@ -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', '' ) ) ); } } -- 2.20.1