From: Happy-melon Date: Fri, 15 Apr 2011 22:11:33 +0000 (+0000) Subject: Follow-up r86041: fix redirect in PurgeAction, and pass query parameters through... X-Git-Tag: 1.31.0-rc.0~30814 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=b71927823e7f38bcaa2a098cbc09b82f2e62e54d;p=lhc%2Fweb%2Fwiklou.git 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. --- 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', '' ) ) ); } }