Last modified: 2013-04-22 16:14:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T41957, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39957 - Expose MediaWiki info action's page watchers value to more users
Expose MediaWiki info action's page watchers value to more users
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 38450
  Show dependency treegraph
 
Reported: 2012-09-04 02:16 UTC by MZMcBride
Modified: 2013-04-22 16:14 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description MZMcBride 2012-09-04 02:16:15 UTC
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 <https://toolserver.org/~mzmcbride/watcher/> 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.
Comment 1 Alex Monk 2012-09-06 15:51:46 UTC
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.
Comment 2 Tyler Romeo 2012-10-08 04:05:53 UTC
https://gerrit.wikimedia.org/r/27134
Comment 3 MZMcBride 2012-10-08 13:13:41 UTC
---
			// 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?
Comment 4 MZMcBride 2012-10-08 13:20:28 UTC
(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.
Comment 5 Tyler Romeo 2012-10-08 20:01:27 UTC
When comparing boolean false is casted to 0 and true is casted to 1.
Comment 6 MZMcBride 2012-12-20 07:21:34 UTC
(In reply to comment #2)
> https://gerrit.wikimedia.org/r/27134

Merged by Ori.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links