I work with MediaWiki all day every day, and I simply cannot agree that this approach is better.
First off, in what way is this better? You may want to add that to your README. As far as I can tell, you’re just randomizing in the application layer instead of the database layer — using cached data, no less. I’d like to know your arguments for this approach. We already need to load the article from the database once we have selected the random article, so we are cutting down on queries by doing it in the database layer.
Is your random somehow scientifically more random? Do we need that kind of precision?
Finally, as a side point, if you have a problem with the way MediaWiki does something, then write an extension to fix it, or try contributing to the project. It’s an open project with a sane review process, so there’s nothing stopping you. That way, you could be helping to improve the product rather than just bemoan it and hack your own solution using an entirely different toolset. But perhaps we’re better off this way. A cached csv of URLs is just not a maintainable approach to this problem.
Yeah this is stupid-simple, and a 5 minute hack (there’s almost no reason to use csv, and the redirect probably isn’t even valid html!). It’s not meant to replace Special:Random at all, but merely to provide a randomly-chosen article from the (static) list of articles curated for Wikipedia Version 0.8.
It’s only “better” in that the ~47,000 articles chosen for Wikipedia 0.8 are specifically higher quality and more interesting in general than the stubs and other nearly-contentless articles Special:Random redirects you to.
I originally wanted a way to specify articles within certain Categores for Special:Random, and that actually exists on the toolserver here: http://toolserver.org/~erwin85/randomarticle.php. However, within category Physics, I got like 10 articles before it started repeating results (in the same order). And I didn’t want to specify every Category. I just wanted a curated list of “good” articles, at random.
Special:Random is probably used for many things other than just providing a randomly “good” article for me to read on my phone while lying in bed. I’m not trying to replace that, and I didn’t really mean for the name to imply that. I don’t see how linking to a random 0.8 article would be an extension anybody would want in Wikipedia, and there’s no reason to include Wikipedia-specific tools in MediaWiki. Sorry for the confusion.
Thanks for giving a detailed response on this. When it comes to MediaWiki as a platform, manually curating articles isn’t scalable. There are programmatic ways to do this right that you can then contribute to the core project.
I would suggest randomly selecting one of the top N articles in a given category sorted by some combination of page views, revisions, age, or number of editors. Take a look at http://www.mediawiki.org/wiki/API:Main_page if you’re interested in really playing with what the MediaWiki API has to offer.
I really enjoyed this article, though I thought the side effects would be negative. Service oriented architecture seems like a great idea, but I feel like due to the speed & ease of writing a monolithic app makes it a good first choice, but then the transition can be painful.
Looks like he’s heard that a few times :)