r105320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105319‎ | r105320 | r105321 >
Date:17:40, 6 December 2011
Author:demon
Status:ok
Tags:
Comment:
Reduce some duplication in Action::getRestriction(), all but 2 (plus one extension) return null anyway
Modified paths:
  • /trunk/phase3/includes/Action.php (modified) (history)
  • /trunk/phase3/includes/actions/CreditsAction.php (modified) (history)
  • /trunk/phase3/includes/actions/HistoryAction.php (modified) (history)
  • /trunk/phase3/includes/actions/InfoAction.php (modified) (history)
  • /trunk/phase3/includes/actions/MarkpatrolledAction.php (modified) (history)
  • /trunk/phase3/includes/actions/PurgeAction.php (modified) (history)
  • /trunk/phase3/includes/actions/RawAction.php (modified) (history)
  • /trunk/phase3/includes/actions/RevertAction.php (modified) (history)
  • /trunk/phase3/includes/actions/RevisiondeleteAction.php (modified) (history)
  • /trunk/phase3/includes/actions/WatchAction.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/actions/InfoAction.php
@@ -29,10 +29,6 @@
3030 return 'info';
3131 }
3232
33 - public function getRestriction() {
34 - return null;
35 - }
36 -
3733 protected function getDescription() {
3834 return '';
3935 }
Index: trunk/phase3/includes/actions/CreditsAction.php
@@ -29,10 +29,6 @@
3030 return 'credits';
3131 }
3232
33 - public function getRestriction() {
34 - return null;
35 - }
36 -
3733 protected function getDescription() {
3834 return wfMsg( 'creditspage' );
3935 }
Index: trunk/phase3/includes/actions/HistoryAction.php
@@ -23,10 +23,6 @@
2424 return 'history';
2525 }
2626
27 - public function getRestriction() {
28 - return null;
29 - }
30 -
3127 public function requiresWrite() {
3228 return false;
3329 }
Index: trunk/phase3/includes/actions/MarkpatrolledAction.php
@@ -28,10 +28,6 @@
2929 return 'markpatrolled';
3030 }
3131
32 - public function getRestriction() {
33 - return null;
34 - }
35 -
3632 protected function getDescription() {
3733 return '';
3834 }
Index: trunk/phase3/includes/actions/RevisiondeleteAction.php
@@ -29,10 +29,6 @@
3030 return 'revisiondelete';
3131 }
3232
33 - public function getRestriction() {
34 - return null;
35 - }
36 -
3733 public function requiresUnblock() {
3834 return false;
3935 }
Index: trunk/phase3/includes/actions/PurgeAction.php
@@ -31,10 +31,6 @@
3232 return 'purge';
3333 }
3434
35 - public function getRestriction() {
36 - return null;
37 - }
38 -
3935 public function requiresUnblock() {
4036 return false;
4137 }
Index: trunk/phase3/includes/actions/WatchAction.php
@@ -26,10 +26,6 @@
2727 return 'watch';
2828 }
2929
30 - public function getRestriction() {
31 - return null;
32 - }
33 -
3430 public function requiresUnblock() {
3531 return false;
3632 }
Index: trunk/phase3/includes/actions/RevertAction.php
@@ -34,10 +34,6 @@
3535 return 'revert';
3636 }
3737
38 - public function getRestriction() {
39 - return null;
40 - }
41 -
4238 public function show() {
4339 $this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' );
4440 }
Index: trunk/phase3/includes/actions/RawAction.php
@@ -24,10 +24,6 @@
2525 return 'raw';
2626 }
2727
28 - public function getRestriction() {
29 - return null;
30 - }
31 -
3228 public function requiresWrite() {
3329 return false;
3430 }
Index: trunk/phase3/includes/Action.php
@@ -201,8 +201,11 @@
202202 /**
203203 * Get the permission required to perform this action. Often, but not always,
204204 * the same as the action name
 205+ * @return String|null
205206 */
206 - public abstract function getRestriction();
 207+ public function getRestriction() {
 208+ return null;
 209+ }
207210
208211 /**
209212 * Checks if the given user (identified by an object) can perform this action. Can be

Status & tagging log