Merge "build: Enable selector-list-comma-newline-after stylelint rule"
[lhc/web/wiklou.git] / includes / actions / PurgeAction.php
index 183c3b9..942b731 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
  */
@@ -45,13 +42,9 @@ class PurgeAction extends FormAction {
        }
 
        public function onSubmit( $data ) {
-               return $this->page->doPurge();
+               return $this->page->doPurge( WikiPage::PURGE_ALL );
        }
 
-       /**
-        * purge is slightly weird because it can be either formed or formless depending
-        * on user permissions
-        */
        public function show() {
                $this->setHeaders();
 
@@ -65,12 +58,12 @@ class PurgeAction extends FormAction {
                        return;
                }
 
-               if ( $user->isAllowed( 'purge' ) ) {
+               if ( $this->getRequest()->wasPosted() ) {
                        $this->redirectParams = wfArrayToCgi( array_diff_key(
                                $this->getRequest()->getQueryValues(),
-                               array( 'title' => null, 'action' => null )
+                               [ 'title' => null, 'action' => null ]
                        ) );
-                       if ( $this->onSubmit( array() ) ) {
+                       if ( $this->onSubmit( [] ) ) {
                                $this->onSuccess();
                        }
                } else {