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 requiresUnblock() {
38 public function getDescription() {
43 * Just get an empty form with a single submit button
46 protected function getFormFields() {
50 public function onSubmit( $data ) {
51 return $this->page
->doPurge();
55 * purge is slightly weird because it can be either formed or formless depending
58 public function show() {
61 // This will throw exceptions if there's a problem
62 $this->checkCanExecute( $this->getUser() );
64 if ( $this->getUser()->isAllowed( 'purge' ) ) {
65 $this->redirectParams
= wfArrayToCGI( array_diff_key(
66 $this->getRequest()->getQueryValues(),
67 array( 'title' => null, 'action' => null )
69 if( $this->onSubmit( array() ) ) {
73 $this->redirectParams
= $this->getRequest()->getVal( 'redirectparams', '' );
74 $form = $this->getForm();
75 if ( $form->show() ) {
81 protected function alterForm( HTMLForm
$form ) {
82 $form->setSubmitTextMsg( 'confirm_purge_button' );
85 protected function preText() {
86 return $this->msg( 'confirm-purge-top' )->parse();
89 protected function postText() {
90 return $this->msg( 'confirm-purge-bottom' )->parse();
93 public function onSuccess() {
94 $this->getOutput()->redirect( $this->getTitle()->getFullUrl( $this->redirectParams
) );