Update git submodules
[lhc/web/wiklou.git] / includes / actions / PurgeAction.php
index 576533d..904c6e2 100644 (file)
  */
 
 /**
- * User-requested page cache purging.
- *
- * For users with 'purge', this will directly trigger the cache purging and
- * for users without that right, it will show a confirmation form.
+ * User-requested page cache purging
  *
  * @ingroup Actions
  */
@@ -48,10 +45,6 @@ class PurgeAction extends FormAction {
                return $this->page->doPurge();
        }
 
-       /**
-        * purge is slightly weird because it can be either formed or formless depending
-        * on user permissions
-        */
        public function show() {
                $this->setHeaders();
 
@@ -65,11 +58,7 @@ class PurgeAction extends FormAction {
                        return;
                }
 
-               if ( $user->isAllowed( 'purge' ) ) {
-                       // This will update the database immediately, even on HTTP GET.
-                       // Lots of uses may exist for this feature, so just ignore warnings.
-                       Profiler::instance()->getTransactionProfiler()->resetExpectations();
-
+               if ( $this->getRequest()->wasPosted() ) {
                        $this->redirectParams = wfArrayToCgi( array_diff_key(
                                $this->getRequest()->getQueryValues(),
                                [ 'title' => null, 'action' => null ]
@@ -86,12 +75,24 @@ class PurgeAction extends FormAction {
                }
        }
 
-       protected function alterForm( HTMLForm $form ) {
-               $form->setSubmitTextMsg( 'confirm_purge_button' );
+       protected function usesOOUI() {
+               return true;
+       }
+
+       protected function getFormFields() {
+               return [
+                       'intro' => [
+                               'type' => 'info',
+                               'vertical-label' => true,
+                               'raw' => true,
+                               'default' => $this->msg( 'confirm-purge-top' )->parse()
+                       ]
+               ];
        }
 
-       protected function preText() {
-               return $this->msg( 'confirm-purge-top' )->parse();
+       protected function alterForm( HTMLForm $form ) {
+               $form->setWrapperLegendMsg( 'confirm-purge-title' );
+               $form->setSubmitTextMsg( 'confirm_purge_button' );
        }
 
        protected function postText() {