From: Tyler Anthony Romeo Date: Mon, 8 Oct 2012 04:04:07 +0000 (-0400) Subject: (bug 39957) Added threshold for showing number of page watchers. X-Git-Tag: 1.31.0-rc.0~21255^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=65f5aa22cfe3779d86b7e79bd5dc1ca8d5993b23;p=lhc%2Fweb%2Fwiklou.git (bug 39957) Added threshold for showing number of page watchers. Added configuation variable that allows bypassing the unwatchedpages permission when the number of people watching a page is greater than a certain threshold. The default value is false, meaning the unwatchedpages permission is always required. Change-Id: I1cb6ee22d50d871a8c7083c5b7a091d31cf640f5 --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index e12b3be3fe..c0c7d766ba 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -5158,6 +5158,13 @@ $wgAllowCategorizedRecentChanges = false; */ $wgUseTagFilter = true; +/** + * If set to an integer, pages that are watched by more users than this + * threshold will not require the unwatchedpages permission to view the + * number of watchers. + */ +$wgUnwatchedPageThreshold = false; + /** @} */ # end RC/watchlist } /************************************************************************//** diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index fb8aea6f81..06c2894a55 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -165,7 +165,7 @@ class InfoAction extends FormlessAction { * @return array */ protected function pageInfo() { - global $wgContLang, $wgRCMaxAge, $wgMemc; + global $wgContLang, $wgRCMaxAge, $wgMemc, $wgUnwatchedPageThreshold; $user = $this->getUser(); $lang = $this->getLanguage(); @@ -265,7 +265,11 @@ class InfoAction extends FormlessAction { ); } - if ( $user->isAllowed( 'unwatchedpages' ) ) { + if ( + $user->isAllowed( 'unwatchedpages' ) || + ( $wgUnwatchedPageThreshold !== false && + $pageCounts['watchers'] >= $wgUnwatchedPageThreshold ) + ) { // Number of page watchers $pageInfo['header-basic'][] = array( $this->msg( 'pageinfo-watchers' ), $lang->formatNum( $pageCounts['watchers'] )