3 * User-requested page cache purging.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 * User-requested page cache purging
28 class PurgeAction
extends FormAction
{
30 private $redirectParams;
32 public function getName() {
36 public function requiresUnblock() {
40 public function getDescription() {
44 public function onSubmit( $data ) {
45 return $this->page
->doPurge( WikiPage
::PURGE_ALL
);
48 public function show() {
51 // This will throw exceptions if there's a problem
52 $this->checkCanExecute( $this->getUser() );
54 $user = $this->getUser();
56 if ( $user->pingLimiter( 'purge' ) ) {
57 // TODO: Display actionthrottledtext
61 if ( $this->getRequest()->wasPosted() ) {
62 $this->redirectParams
= wfArrayToCgi( array_diff_key(
63 $this->getRequest()->getQueryValues(),
64 [ 'title' => null, 'action' => null ]
66 if ( $this->onSubmit( [] ) ) {
70 $this->redirectParams
= $this->getRequest()->getVal( 'redirectparams', '' );
71 $form = $this->getForm();
72 if ( $form->show() ) {
78 protected function alterForm( HTMLForm
$form ) {
79 $form->setSubmitTextMsg( 'confirm_purge_button' );
82 protected function preText() {
83 return $this->msg( 'confirm-purge-top' )->parse();
86 protected function postText() {
87 return $this->msg( 'confirm-purge-bottom' )->parse();
90 public function onSuccess() {
91 $this->getOutput()->redirect( $this->getTitle()->getFullURL( $this->redirectParams
) );
94 public function doesWrites() {