(bug 39957) Added threshold for showing number of page watchers.
[lhc/web/wiklou.git] / includes / actions / InfoAction.php
index fb8aea6..06c2894 100644 (file)
@@ -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'] )