From 6be73092dbb4bf2e7308fe819c0a19f3f1f7ed25 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Fri, 22 Dec 2006 20:21:14 +0000 Subject: [PATCH] Introduce 'PingLimiter' hook for overriding the result of User::pingLimiter() --- RELEASE-NOTES | 1 + docs/hooks.txt | 7 +++++++ includes/User.php | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 371fb34b00..a1c7ce4a33 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -376,6 +376,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN patrolled automatically * Users who do not have the "autopatrol" permission will no longer be able to mark their own edits as patrolled +* Introduce 'PingLimiter' hook; see docs/hooks.txt for more information == Languages updated == diff --git a/docs/hooks.txt b/docs/hooks.txt index 104a665869..66b3f3cee4 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -416,6 +416,13 @@ my talk page, my contributions" etc). &$personal_urls: Array of link specifiers (see SkinTemplate.php) &$title: Title object representing the current page +'PingLimiter': Allows extensions to override the results of User::pingLimiter() +&$user : User performing the action +$action : Action being performed +&$result : Whether or not the action should be prevented +Change $result and return false to give a definitive answer, otherwise +the built-in rate limiting checks are used, if enabled. + 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed &$siteNotice: HTML returned as the sitenotice Return true to allow the normal method of notice selection/rendering to work, diff --git a/includes/User.php b/includes/User.php index ae92160db0..1febe511d4 100644 --- a/includes/User.php +++ b/includes/User.php @@ -920,6 +920,13 @@ class User { * @public */ function pingLimiter( $action='edit' ) { + + # Call the 'PingLimiter' hook + $result = false; + if( !wfRunHooks( 'PingLimiter', array( &$this, $action, $result ) ) ) { + return $result; + } + global $wgRateLimits, $wgRateLimitsExcludedGroups; if( !isset( $wgRateLimits[$action] ) ) { return false; -- 2.20.1