Last modified: 2014-07-24 04:46:45 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 T48420, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 46420 - [[Special:RandomRootPage/]] returns also from other namespace than main only
[[Special:RandomRootPage/]] returns also from other namespace than main only
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
RandomRootPage (Other open bugs)
unspecified
All All
: Low minor (vote)
: ---
Assigned To: Huji
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-21 14:23 UTC by Danny B.
Modified: 2014-07-24 04:46 UTC (History)
5 users (show)

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


Attachments

Description Danny B. 2013-03-21 14:23:25 UTC
[[Special:RandomRootPage/]] returns also from other namespace than main only.

Seems it returns either from content namespaces or 0 + any other even ns >= 100?

On cswikisouirce it returns from ns:0 and ns:100, which are both set as content ns.

It should return only main ns, because it is specified. (unlike [[Special:RandomRootPage]] which also returns ns:0 and ns:100 - assuming the content namespaces.)
Comment 1 Bawolff (Brian Wolff) 2013-04-17 23:00:08 UTC
Does this bug happen for [[Special:random]] too?
Comment 2 billinghurst 2014-06-11 13:44:11 UTC
[[Special:Random]] is definitely problematic at this time (for English Wikisource) whether that was the case at that time is unknown.
Comment 3 Neil Babbage 2014-06-20 08:25:58 UTC
I am having a problem with randomrootpage on en.wikibooks where it has started to behave the same way as [[Special:Random]] returning pages that are not root pages.
Comment 4 Neil Babbage 2014-06-20 14:04:04 UTC
Problem appears to have started at en.wikibooks following the deployment of 1.24/wmf9
Comment 5 Sam Reed (reedy) 2014-06-20 14:08:56 UTC
I guess the problem is that we're not using ElasticSearch to do the randomness.

Meaning the SQL query, and as such, the amended SQL query for Special:RandomRootPage isn't actually run...


Transplanting something like the below into the extension would fix this issue

	/**
	 * Choose a random title.
	 * @return Title|null Title object (or null if nothing to choose from)
	 */
	public function getRandomTitle() {
		$row = $this->selectRandomPageFromDB( wfRandom() );

		/* If we picked a value that was higher than any in
		 * the DB, wrap around and select the page with the
		 * lowest value instead!  One might think this would
		 * skew the distribution, but in fact it won't cause
		 * any more bias than what the page_random scheme
		 * causes anyway.  Trust me, I'm a mathematician. :)
		 */
		if ( !$row ) {
			$row = $this->selectRandomPageFromDB( "0" );
		}

		if ( $row ) {
			return Title::makeTitleSafe( $row->page_namespace, $row->page_title );
		}

		return null;
	}
Comment 6 Sam Reed (reedy) 2014-06-20 14:10:14 UTC
(In reply to Sam Reed (reedy) from comment #5)
> I guess the problem is that we're not using ElasticSearch to do the
> randomness.

now, not not.

I guess the problem is that we're now using ElasticSearch to do the randomness.
Comment 7 Bawolff (Brian Wolff) 2014-06-20 14:11:09 UTC
(In reply to billinghurst from comment #2)
> [[Special:Random]] is definitely problematic at this time (for English
> Wikisource) whether that was the case at that time is unknown.

I've split this to bug 66879. Lets keep separate bugs separate
Comment 8 Sam Reed (reedy) 2014-06-20 14:14:57 UTC
For the original problem...

$this->namespaces = MWNamespace::getContentNamespaces();


Just need to modify $this->namespaces in the constructor on the extension
Comment 9 Gerrit Notification Bot 2014-06-20 14:47:33 UTC
Change 140916 had a related patch set uploaded by Brian Wolff:
Allow specifying a random page only in main namespace

https://gerrit.wikimedia.org/r/140916
Comment 10 Bawolff (Brian Wolff) 2014-06-20 15:07:56 UTC
I also just discovered that doing Special:RandomRootPage/main should also work (and has for quite a while).
Comment 11 Gerrit Notification Bot 2014-07-24 02:31:18 UTC
Change 140916 merged by jenkins-bot:
Allow specifying a random page only in main namespace

https://gerrit.wikimedia.org/r/140916
Comment 12 Bawolff (Brian Wolff) 2014-07-24 04:46:45 UTC
Should start working on July 29

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


Navigation
Links