From 394a5ba7a79e8017bb04c5155c6d8820789effa8 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 6 Dec 2011 17:40:12 +0000 Subject: [PATCH] Reduce some duplication in Action::getRestriction(), all but 2 (plus one extension) return null anyway --- includes/Action.php | 5 ++++- includes/actions/CreditsAction.php | 4 ---- includes/actions/HistoryAction.php | 4 ---- includes/actions/InfoAction.php | 4 ---- includes/actions/MarkpatrolledAction.php | 4 ---- includes/actions/PurgeAction.php | 4 ---- includes/actions/RawAction.php | 4 ---- includes/actions/RevertAction.php | 4 ---- includes/actions/RevisiondeleteAction.php | 4 ---- includes/actions/WatchAction.php | 4 ---- 10 files changed, 4 insertions(+), 37 deletions(-) diff --git a/includes/Action.php b/includes/Action.php index 09d590af75..b5e54d9b1c 100644 --- a/includes/Action.php +++ b/includes/Action.php @@ -201,8 +201,11 @@ abstract class Action { /** * 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 diff --git a/includes/actions/CreditsAction.php b/includes/actions/CreditsAction.php index f28159febc..3b2f77eb2e 100644 --- a/includes/actions/CreditsAction.php +++ b/includes/actions/CreditsAction.php @@ -29,10 +29,6 @@ class CreditsAction extends FormlessAction { return 'credits'; } - public function getRestriction() { - return null; - } - protected function getDescription() { return wfMsg( 'creditspage' ); } diff --git a/includes/actions/HistoryAction.php b/includes/actions/HistoryAction.php index bae484b02b..aa1ec45c70 100644 --- a/includes/actions/HistoryAction.php +++ b/includes/actions/HistoryAction.php @@ -23,10 +23,6 @@ class HistoryAction extends FormlessAction { return 'history'; } - public function getRestriction() { - return null; - } - public function requiresWrite() { return false; } diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 715f1f9870..e3e80e37cf 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -29,10 +29,6 @@ class InfoAction extends FormlessAction { return 'info'; } - public function getRestriction() { - return null; - } - protected function getDescription() { return ''; } diff --git a/includes/actions/MarkpatrolledAction.php b/includes/actions/MarkpatrolledAction.php index b4d41f16c7..ae9223f457 100644 --- a/includes/actions/MarkpatrolledAction.php +++ b/includes/actions/MarkpatrolledAction.php @@ -28,10 +28,6 @@ class MarkpatrolledAction extends FormlessAction { return 'markpatrolled'; } - public function getRestriction() { - return null; - } - protected function getDescription() { return ''; } diff --git a/includes/actions/PurgeAction.php b/includes/actions/PurgeAction.php index e288785f3d..21a6d90419 100644 --- a/includes/actions/PurgeAction.php +++ b/includes/actions/PurgeAction.php @@ -31,10 +31,6 @@ class PurgeAction extends FormAction { return 'purge'; } - public function getRestriction() { - return null; - } - public function requiresUnblock() { return false; } diff --git a/includes/actions/RawAction.php b/includes/actions/RawAction.php index 67d31172f7..6bf7a53376 100644 --- a/includes/actions/RawAction.php +++ b/includes/actions/RawAction.php @@ -24,10 +24,6 @@ class RawAction extends FormlessAction { return 'raw'; } - public function getRestriction() { - return null; - } - public function requiresWrite() { return false; } diff --git a/includes/actions/RevertAction.php b/includes/actions/RevertAction.php index f002ef1201..567d0c37f8 100644 --- a/includes/actions/RevertAction.php +++ b/includes/actions/RevertAction.php @@ -34,10 +34,6 @@ class RevertAction extends Action { return 'revert'; } - public function getRestriction() { - return null; - } - public function show() { $this->getOutput()->showErrorPage( 'nosuchaction', 'nosuchactiontext' ); } diff --git a/includes/actions/RevisiondeleteAction.php b/includes/actions/RevisiondeleteAction.php index 2ac03d1824..f07e493d9c 100644 --- a/includes/actions/RevisiondeleteAction.php +++ b/includes/actions/RevisiondeleteAction.php @@ -29,10 +29,6 @@ class RevisiondeleteAction extends FormlessAction { return 'revisiondelete'; } - public function getRestriction() { - return null; - } - public function requiresUnblock() { return false; } diff --git a/includes/actions/WatchAction.php b/includes/actions/WatchAction.php index f4d6d50cb4..d72fff1384 100644 --- a/includes/actions/WatchAction.php +++ b/includes/actions/WatchAction.php @@ -26,10 +26,6 @@ class WatchAction extends FormAction { return 'watch'; } - public function getRestriction() { - return null; - } - public function requiresUnblock() { return false; } -- 2.20.1