Page MenuHomePhabricator

Expose MediaWiki info action's page watchers value to more users
Closed, ResolvedPublic


Previously I successfully lobbied the Toolserver to add a MySQL view to the watchlist table allowing anonymous data-gathering from the table (namely the ability to count the number of watchers for a particular page title). Once the MySQL view was added, I created a somewhat popular tool at that takes a title (or titles, separated by pipe characters) and returns the number of page watchers for each page title.

In the tool's original implementation, there were no restrictions on who could see how many people were watching a particular page. Certain Wikimedians were worried that this information would be used by bad users as a tool to find unwatched (or not well watched) pages to vandalize. These concerned Wikimedians lobbied the Toolserver roots to add a rule about exposing this data. There is now a limit in the tool to not expose the number of watchers if the value is less than 30.

MediaWiki's info action has now been reimplemented and it currently includes a number of page watchers entry for users with the "unwatchedpages" user right (wiki administrators by default).

I think it would be nice if the number of watchers could be shown to more than just users with the "unwatchedpages" user right. Exposing the number of watchers of a particular page title to more users than just those with the "unwatchedpages" user right is the subject of this bug.

One possible solution is to add a wiki configuration variable, something like $wgInfoActionPageWatchersThreshold. This variable could be equal to 0 by default, but could be set to 30 on Wikimedia wikis (or on the English Wikipedia in particular). InfoAction.php would then use logic that looks something like this (pseudo-code ahead):

if $user->isAllowed( 'unwatchedpages' ) OR $number_of_page_watchers >= $wgInfoActionPageWatchersThreshold {

$userCanViewUnwatchedPages = true;


It would be nice to reduce the reliance on the Toolserver for this data and provide a native way to expose this interesting data point to more than just wiki administrators.

Personally, I don't think it's an issue to show the number of page watchers to anyone and everyone (thus the suggestion that the threshold be 0 by default in MediaWiki core), but others (specifically certain Wikimedians) feel differently.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:00 AM
bzimport set Reference to bz39957.
bzimport added a subscriber: Unknown Object (MLST).

In my opinion, $wgInfoActionPageWatchersThreshold should default to false (or -1?) which should make it use the current behaviour (don't show the number at all unless the user has the 'unwatchedpages' permission).
You should then ask on a mailing list (wikitech-l/wikimedia-l?) and meta before setting it to anything else on Wikimedia wikis.

			// If the number of watches exceeds the threshold, do not
			// require a permission.
			if ( $watchers >= $wgUnwatchedPageThreshold ) {
				$unwatchedAllowed = true;

			// If allowed, add the statistic.
			if ( $unwatchedAllowed ) {
				$result['watchers'] = $watchers;

I think this is a bit weird.

Does integer >= false really work?

And why are you creating a separate branch after just creating this variable? Wouldn't doing all of this in a single if be cleaner?

(In reply to comment #3)

Does integer >= false really work?

Never mind, you're already checking $wgUnwatchedPageThreshold !== false earlier. It does seem that PHP's comparison logic with integers and bools is as crazy as one would expect, though.

When comparing boolean false is casted to 0 and true is casted to 1.