MediaWiki  1.23.12
PurgeAction.php
Go to the documentation of this file.
1 <?php
31 class PurgeAction extends FormAction {
32 
33  private $redirectParams;
34 
35  public function getName() {
36  return 'purge';
37  }
38 
39  public function requiresUnblock() {
40  return false;
41  }
42 
43  public function getDescription() {
44  return '';
45  }
46 
51  protected function getFormFields() {
52  return array();
53  }
54 
55  public function onSubmit( $data ) {
56  return $this->page->doPurge();
57  }
58 
63  public function show() {
64  $this->setHeaders();
65 
66  // This will throw exceptions if there's a problem
67  $this->checkCanExecute( $this->getUser() );
68 
69  if ( $this->getUser()->isAllowed( 'purge' ) ) {
70  $this->redirectParams = wfArrayToCgi( array_diff_key(
71  $this->getRequest()->getQueryValues(),
72  array( 'title' => null, 'action' => null )
73  ) );
74  if ( $this->onSubmit( array() ) ) {
75  $this->onSuccess();
76  }
77  } else {
78  $this->redirectParams = $this->getRequest()->getVal( 'redirectparams', '' );
79  $form = $this->getForm();
80  if ( $form->show() ) {
81  $this->onSuccess();
82  }
83  }
84  }
85 
86  protected function alterForm( HTMLForm $form ) {
87  $form->setSubmitTextMsg( 'confirm_purge_button' );
88  }
89 
90  protected function preText() {
91  return $this->msg( 'confirm-purge-top' )->parse();
92  }
93 
94  protected function postText() {
95  return $this->msg( 'confirm-purge-bottom' )->parse();
96  }
97 
98  public function onSuccess() {
99  $this->getOutput()->redirect( $this->getTitle()->getFullURL( $this->redirectParams ) );
100  }
101 }
PurgeAction\postText
postText()
Definition: PurgeAction.php:94
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
Action\setHeaders
setHeaders()
Set output headers for noindexing etc.
Definition: Action.php:338
Action\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: Action.php:182
$form
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead $form
Definition: hooks.txt:2578
PurgeAction
User-requested page cache purging.
Definition: PurgeAction.php:31
FormAction
An action which shows a form and does something based on the input from the form.
Definition: FormAction.php:29
PurgeAction\show
show()
purge is slightly weird because it can be either formed or formless depending on user permissions
Definition: PurgeAction.php:63
PurgeAction\getName
getName()
Return the name of the action this object responds to.
Definition: PurgeAction.php:35
Action\checkCanExecute
checkCanExecute(User $user)
Checks if the given user (identified by an object) can perform this action.
Definition: Action.php:295
PurgeAction\requiresUnblock
requiresUnblock()
Whether this action can still be executed by a blocked user.
Definition: PurgeAction.php:39
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
FormAction\getForm
getForm()
Get the HTMLForm to control behavior.
Definition: FormAction.php:63
Action\getUser
getUser()
Shortcut to get the User being used for this instance.
Definition: Action.php:200
PurgeAction\preText
preText()
Add pre- or post-text to the form.
Definition: PurgeAction.php:90
Action\getTitle
getTitle()
Shortcut to get the Title object from the page.
Definition: Action.php:237
PurgeAction\getFormFields
getFormFields()
Just get an empty form with a single submit button.
Definition: PurgeAction.php:51
PurgeAction\onSubmit
onSubmit( $data)
Process the form on POST submission.
Definition: PurgeAction.php:55
Action\msg
msg()
Get a Message object with context set Parameters are the same as wfMessage()
Definition: Action.php:247
PurgeAction\$redirectParams
$redirectParams
Definition: PurgeAction.php:33
PurgeAction\onSuccess
onSuccess()
Do something exciting on successful processing of the form.
Definition: PurgeAction.php:98
Action\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: Action.php:191
PurgeAction\alterForm
alterForm(HTMLForm $form)
Play with the HTMLForm if you need to more substantially.
Definition: PurgeAction.php:86
PurgeAction\getDescription
getDescription()
Returns the description that goes below the <h1> tag.
Definition: PurgeAction.php:43
page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page
Definition: hooks.txt:1961
HTMLForm
Object handling generic submission, CSRF protection, layout and other logic for UI forms.
Definition: HTMLForm.php:100
wfArrayToCgi
wfArrayToCgi( $array1, $array2=null, $prefix='')
This function takes two arrays as input, and returns a CGI-style string, e.g.
Definition: GlobalFunctions.php:414