https://www.mediawiki.org/wiki/Special:Code/MediaWiki/105320

Revision: 105320
Author:   demon
Date:     2011-12-06 17:40:12 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Reduce some duplication in Action::getRestriction(), all but 2 (plus one 
extension) return null anyway

Modified Paths:
--------------
    trunk/phase3/includes/Action.php
    trunk/phase3/includes/actions/CreditsAction.php
    trunk/phase3/includes/actions/HistoryAction.php
    trunk/phase3/includes/actions/InfoAction.php
    trunk/phase3/includes/actions/MarkpatrolledAction.php
    trunk/phase3/includes/actions/PurgeAction.php
    trunk/phase3/includes/actions/RawAction.php
    trunk/phase3/includes/actions/RevertAction.php
    trunk/phase3/includes/actions/RevisiondeleteAction.php
    trunk/phase3/includes/actions/WatchAction.php

Modified: trunk/phase3/includes/Action.php
===================================================================
--- trunk/phase3/includes/Action.php    2011-12-06 17:17:40 UTC (rev 105319)
+++ trunk/phase3/includes/Action.php    2011-12-06 17:40:12 UTC (rev 105320)
@@ -201,8 +201,11 @@
        /**
         * Get the permission required to perform this action.  Often, but not 
always,
         * the same as the action name
+        * @return String|null
         */
-       public abstract function getRestriction();
+       public function getRestriction() {
+               return null;
+       }
 
        /**
         * Checks if the given user (identified by an object) can perform this 
action.  Can be

Modified: trunk/phase3/includes/actions/CreditsAction.php
===================================================================
--- trunk/phase3/includes/actions/CreditsAction.php     2011-12-06 17:17:40 UTC 
(rev 105319)
+++ trunk/phase3/includes/actions/CreditsAction.php     2011-12-06 17:40:12 UTC 
(rev 105320)
@@ -29,10 +29,6 @@
                return 'credits';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        protected function getDescription() {
                return wfMsg( 'creditspage' );
        }

Modified: trunk/phase3/includes/actions/HistoryAction.php
===================================================================
--- trunk/phase3/includes/actions/HistoryAction.php     2011-12-06 17:17:40 UTC 
(rev 105319)
+++ trunk/phase3/includes/actions/HistoryAction.php     2011-12-06 17:40:12 UTC 
(rev 105320)
@@ -23,10 +23,6 @@
                return 'history';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        public function requiresWrite() {
                return false;
        }

Modified: trunk/phase3/includes/actions/InfoAction.php
===================================================================
--- trunk/phase3/includes/actions/InfoAction.php        2011-12-06 17:17:40 UTC 
(rev 105319)
+++ trunk/phase3/includes/actions/InfoAction.php        2011-12-06 17:40:12 UTC 
(rev 105320)
@@ -29,10 +29,6 @@
                return 'info';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        protected function getDescription() {
                return '';
        }

Modified: trunk/phase3/includes/actions/MarkpatrolledAction.php
===================================================================
--- trunk/phase3/includes/actions/MarkpatrolledAction.php       2011-12-06 
17:17:40 UTC (rev 105319)
+++ trunk/phase3/includes/actions/MarkpatrolledAction.php       2011-12-06 
17:40:12 UTC (rev 105320)
@@ -28,10 +28,6 @@
                return 'markpatrolled';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        protected function getDescription() {
                return '';
        }

Modified: trunk/phase3/includes/actions/PurgeAction.php
===================================================================
--- trunk/phase3/includes/actions/PurgeAction.php       2011-12-06 17:17:40 UTC 
(rev 105319)
+++ trunk/phase3/includes/actions/PurgeAction.php       2011-12-06 17:40:12 UTC 
(rev 105320)
@@ -31,10 +31,6 @@
                return 'purge';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        public function requiresUnblock() {
                return false;
        }

Modified: trunk/phase3/includes/actions/RawAction.php
===================================================================
--- trunk/phase3/includes/actions/RawAction.php 2011-12-06 17:17:40 UTC (rev 
105319)
+++ trunk/phase3/includes/actions/RawAction.php 2011-12-06 17:40:12 UTC (rev 
105320)
@@ -24,10 +24,6 @@
                return 'raw';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        public function requiresWrite() {
                return false;
        }

Modified: trunk/phase3/includes/actions/RevertAction.php
===================================================================
--- trunk/phase3/includes/actions/RevertAction.php      2011-12-06 17:17:40 UTC 
(rev 105319)
+++ trunk/phase3/includes/actions/RevertAction.php      2011-12-06 17:40:12 UTC 
(rev 105320)
@@ -34,10 +34,6 @@
                return 'revert';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        public function show() {
                $this->getOutput()->showErrorPage( 'nosuchaction', 
'nosuchactiontext' );
        }

Modified: trunk/phase3/includes/actions/RevisiondeleteAction.php
===================================================================
--- trunk/phase3/includes/actions/RevisiondeleteAction.php      2011-12-06 
17:17:40 UTC (rev 105319)
+++ trunk/phase3/includes/actions/RevisiondeleteAction.php      2011-12-06 
17:40:12 UTC (rev 105320)
@@ -29,10 +29,6 @@
                return 'revisiondelete';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        public function requiresUnblock() {
                return false;
        }

Modified: trunk/phase3/includes/actions/WatchAction.php
===================================================================
--- trunk/phase3/includes/actions/WatchAction.php       2011-12-06 17:17:40 UTC 
(rev 105319)
+++ trunk/phase3/includes/actions/WatchAction.php       2011-12-06 17:40:12 UTC 
(rev 105320)
@@ -26,10 +26,6 @@
                return 'watch';
        }
 
-       public function getRestriction() {
-               return null;
-       }
-
        public function requiresUnblock() {
                return false;
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to