Merge "Http::getProxy() method to get proxy configuration"
[lhc/web/wiklou.git] / includes / actions / PurgeAction.php
index ed0bff7..508bbe0 100644 (file)
@@ -44,14 +44,6 @@ class PurgeAction extends FormAction {
                return '';
        }
 
-       /**
-        * Just get an empty form with a single submit button
-        * @return array
-        */
-       protected function getFormFields() {
-               return array();
-       }
-
        public function onSubmit( $data ) {
                return $this->page->doPurge();
        }
@@ -66,12 +58,19 @@ class PurgeAction extends FormAction {
                // This will throw exceptions if there's a problem
                $this->checkCanExecute( $this->getUser() );
 
-               if ( $this->getUser()->isAllowed( 'purge' ) ) {
+               $user = $this->getUser();
+
+               if ( $user->pingLimiter( 'purge' ) ) {
+                       // TODO: Display actionthrottledtext
+                       return;
+               }
+
+               if ( $user->isAllowed( 'purge' ) ) {
                        $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 {
@@ -98,4 +97,8 @@ class PurgeAction extends FormAction {
        public function onSuccess() {
                $this->getOutput()->redirect( $this->getTitle()->getFullURL( $this->redirectParams ) );
        }
+
+       public function doesWrites() {
+               return true;
+       }
 }