MediaWiki
REL1_22
|
00001 <?php 00031 class PurgeAction extends FormAction { 00032 00033 private $redirectParams; 00034 00035 public function getName() { 00036 return 'purge'; 00037 } 00038 00039 public function requiresUnblock() { 00040 return false; 00041 } 00042 00043 public function getDescription() { 00044 return ''; 00045 } 00046 00051 protected function getFormFields() { 00052 return array(); 00053 } 00054 00055 public function onSubmit( $data ) { 00056 return $this->page->doPurge(); 00057 } 00058 00063 public function show() { 00064 $this->setHeaders(); 00065 00066 // This will throw exceptions if there's a problem 00067 $this->checkCanExecute( $this->getUser() ); 00068 00069 if ( $this->getUser()->isAllowed( 'purge' ) ) { 00070 $this->redirectParams = wfArrayToCgi( array_diff_key( 00071 $this->getRequest()->getQueryValues(), 00072 array( 'title' => null, 'action' => null ) 00073 ) ); 00074 if ( $this->onSubmit( array() ) ) { 00075 $this->onSuccess(); 00076 } 00077 } else { 00078 $this->redirectParams = $this->getRequest()->getVal( 'redirectparams', '' ); 00079 $form = $this->getForm(); 00080 if ( $form->show() ) { 00081 $this->onSuccess(); 00082 } 00083 } 00084 } 00085 00086 protected function alterForm( HTMLForm $form ) { 00087 $form->setSubmitTextMsg( 'confirm_purge_button' ); 00088 } 00089 00090 protected function preText() { 00091 return $this->msg( 'confirm-purge-top' )->parse(); 00092 } 00093 00094 protected function postText() { 00095 return $this->msg( 'confirm-purge-bottom' )->parse(); 00096 } 00097 00098 public function onSuccess() { 00099 $this->getOutput()->redirect( $this->getTitle()->getFullURL( $this->redirectParams ) ); 00100 } 00101 }