3 * Formats credits for articles
5 * Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 * @author <evan@wikitravel.org>
26 class PurgeAction
extends FormAction
{
28 private $redirectParams;
30 public function getName() {
34 public function getRestriction() {
38 public function requiresUnblock() {
42 public function getDescription() {
47 * Just get an empty form with a single submit button
50 protected function getFormFields() {
54 public function onSubmit( $data ) {
55 $this->page
->doPurge();
60 * purge is slightly wierd because it can be either formed or formless depending
63 public function show() {
66 // This will throw exceptions if there's a problem
67 $this->checkCanExecute( $this->getUser() );
69 if ( $this->getUser()->isAllowed( 'purge' ) ) {
70 $this->redirectParams
= wfArrayToCGI( array_diff_key(
71 $this->getRequest()->getQueryValues(),
72 array( 'title' => null, 'action' => null )
74 $this->onSubmit( array() );
77 $this->redirectParams
= $this->getRequest()->getVal( 'redirectparams', '' );
78 $form = $this->getForm();
79 if ( $form->show() ) {
85 protected function alterForm( HTMLForm
$form ) {
86 $form->setSubmitText( wfMsg( 'confirm_purge_button' ) );
89 protected function preText() {
90 return wfMessage( 'confirm-purge-top' )->parse();
93 protected function postText() {
94 return wfMessage( 'confirm-purge-bottom' )->parse();
97 public function onSuccess() {
98 $this->getOutput()->redirect( $this->getTitle()->getFullUrl( $this->redirectParams
) );