Pages

Showing posts with label MediaWiki. Show all posts
Showing posts with label MediaWiki. Show all posts

Tuesday, August 9, 2011

ArmchairGM is finally open source

Update on 28 August 2013: Wikia moved to GitHub from SVN in late 2012 and as of today, their SVN (at wikia-code.com) appears to be unreachable, so I've uploaded the full ArmchairGM source code to GitHub.
You can browse the source tree at https://github.com/mary-kate/ArmchairGM, but please make sure to read the README file before asking any questions about it.

August 1, 2011 was an important day in the history of open source software. That's when Wikia finally open-sourced the ArmchairGM codebase. You can browse the ArmchairGM codebase or even grab a copy of the ArmchairGM codebase, if you feel like it!

A bit of history


Over a year ago I tried open-sourcing the ArmchairGM codebase, but my idea was met with resistance and travelling to another country just to perform code cleanup — something you can do "online" by grabbing a copy of the codebase and then cleaning it up locally — was just not possible for me.

Later on, Sean Colombo, an awesome open source developer and the founder of LyricWiki, joined Wikia's technical team since LyricWiki moved to Wikia. On July 14th, I decided to e-mail Sean, just for the sake of it, to see if he'd be willing to help me out in making ArmchairGM's codebase open source.
You can believe that I was very surprised when I didn't receive the standard "sorry, can't do" reply that I've gotten used to getting from Wikia in response to my queries, but rather a sincere reply in which Sean stated that he'd be willing to help me out. Over the next two weeks, Sean worked hard to make sure that the ArmchairGM codebase would be ready to be released by removing private passwords and such things. And then, on August 1, it finally happened.
I was amazed that he took my original request — I had asked for a few ArmchairGM extensions and the skin — a couple steps further and open-sourced the entire codebase!

About the ArmchairGM codebase


The ArmchairGM codebase is based on MediaWiki 1.10alpha; the work on MediaWiki 1.10 started on 8 January 2007.
The current development version of MediaWiki is 1.19, the latest stable version is 1.17 and 1.18 will be released soon. So, as you can see, it's a bit old. After all, ArmchairGM was running on that 1.10alpha until early 2011, when it was upgraded to use the standard Wikia codebase.

Most of the interesting things can be found on the extensions and skins directories.

The extensions directory and its wikia subdirectory contain all the extensions used by ArmchairGM and/or created by Wikia developers — including ones that were short-lived, such as Challenge, or never enabled on ArmchairGM, such as LookupContribs.

The skins directory contains all the skins ever developed by the ArmchairGM staff, including the Sports skin used on ArmchairGM from 2007 to early 2011, its earlier incarnation, called simply ArmchairGM, the Halopedia skin and the Gamespot version of it, and plenty more. It should be noted that while this directory has plenty of PHP and CSS files (and even some JS files), most of the images used by custom skins are not there — some are accessible on Wikia's servers if you know where to look for them, some are permanently gone.

What about core hacks? Wikia has done and continues to do core hacks whenever they need to do something that MediaWiki doesn't support out-of-the-box. So far I've come across a few, relatively minor, yet unmarked core code hacks in the ArmchairGM codebase. I'm hoping that I'll have enough time later this year or the next year so that I can build a diff showing the differences between a standard MediaWiki 1.10alpha and the ArmchairGM version.
Needless to say that such a thing will be quite difficult to do, because "1.10alpha" can mean pretty much any version of MediaWiki between r18957 (committed on 8 January 2011) and r21732 (committed on 1 May 2007) — that's 2775 revisions of code, and the ArmchairGM codebase could've been forked from any of those revisions.

Update on 15 August 2011: I had totally forgotten about the existence of the RELEASE-NOTES file. Comparing the RELEASE-NOTES file of the ArmchairGM codebase to the RELEASE-NOTES of MediaWiki 1.10alpha at various points of development allowed me to track down the revision of MediaWiki that the ArmchairGM codebase is in. I believe that it's either r20138 or a revision very close to it.

To generate a patch file showing the differences between the standard MediaWiki codebase and the ArmchairGM codebase, first export a copy of MediaWiki at r20138:

svn export -r 20138 http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3 MW-r20138

Then export a copy of the ArmchairGM codebase:

svn export https://svn.wikia-code.com/wikia/branches/wikia-ny/trunk NYC

And finally generate the patch:
diff -ur MW-r20138 NYC > diff-between-NYC-and-vanilla-MW-r20138.patch

Some changes are useless, like the change to includes/AjaxDispatcher.php, some are plain weird (like the various API changes to the files in the includes/api directory), and some changes (mostly the ones to OutputPage.php and SpecialPreferences.php) are a bit hard to read — but hey, there you have it, a file showing what changes were done to the core MediaWiki software by ArmchairGM's developers.
Most of the custom functionality that you once saw in ArmchairGM was done via extensions, thankfully, not via core changes; in addition to extensions, the skins also played a part — skins developed by ArmchairGM's developers usually implemented some custom handling for the main page of the wiki, for example, while a vanilla installation of MediaWiki with the default skin treats the wiki's main page the same way it would treat any other page.

For your viewing conveniece, here's a list of core MediaWiki files (81 in total) which differ between the ArmchairGM codebase and revision 20138 of MediaWiki:

extensions/README
includes/AjaxDispatcher.php
includes/AjaxFunctions.php
includes/api/ApiBase.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiFormatBase.php
includes/api/ApiFormatJson.php
includes/api/ApiFormatPhp.php
includes/api/ApiFormatWddx.php
includes/api/ApiFormatXml.php
includes/api/ApiFormatYaml.php
includes/api/ApiHelp.php
includes/api/ApiLogin.php
includes/api/ApiMain.php
includes/api/ApiOpenSearch.php
includes/api/ApiPageSet.php
includes/api/ApiQueryAllpages.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQuery.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryWatchlist.php
includes/Article.php
includes/AutoLoader.php
includes/Database.php
includes/DefaultSettings.php
includes/DifferenceEngine.php
includes/EditPage.php
includes/Export.php
includes/GlobalFunctions.php
includes/Image.php
includes/LoadBalancer.php
includes/memcached-client.php
includes/MemcachedSessions.php
includes/MessageCache.php
includes/OutputPage.php
includes/ParserCache.php
includes/Parser.php
includes/QueryPage.php
includes/Sanitizer.php
includes/Skin.php
includes/SkinTemplate.php
includes/SpecialAllmessages.php
includes/SpecialConfirmemail.php
includes/SpecialContributions.php
includes/SpecialExport.php
includes/SpecialListusers.php
includes/SpecialLog.php
includes/SpecialMovepage.php
includes/SpecialNewpages.php
includes/SpecialPage.php
includes/SpecialPreferences.php
includes/SpecialRecentchanges.php
includes/SpecialSearch.php
includes/SpecialUndelete.php
includes/SpecialUpload.php
includes/SpecialUserlogin.php
includes/SpecialVersion.php
includes/SpecialWantedpages.php
includes/templates/Userlogin.php
includes/Title.php
includes/User.php
includes/WebStart.php
index.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php
maintenance/deleteDefaultMessages.php
maintenance/dumpBackup.php
maintenance/generateSitemap.php
maintenance/postgres/tables.sql
maintenance/runJobs.php
skins/common/ajaxsearch.js
skins/common/common.css
skins/common/wikibits.js
skins/monobook/main.css
skins/monobook/rtl.css
skins/MonoBook.php


Ending Notes


Sure, the ArmchairGM codebase is old and plenty of stuff needs to be rewritten so that it even runs, let alone works properly, on modern versions of MediaWiki.
That being said, I'm glad that the ArmchairGM codebase is now open source — better late than never, as they say.

Thursday, March 31, 2011

Status update on SocialProfile for Q1/2011

This is the first quarterly update about the SocialProfile extension for MediaWiki, from January 1, 2011 to March 31, 2011.

Fixed bugs



  • Bug #26588 — image converting code should use $wgImageMagickConvertCommand instead of hardcoded "convert" (fixed in r79662)

  • Bug #28251 — SQL error in user profile pages (fixed in r84806)

  • Bug #27032 — new EditProfile special page to edit other users' social profiles



Other notable things




Plans for the future



  • Fix all open SocialProfile bugs — currently there are 6 open bugs; most of them aren't too complicated, so it should be possible to get them fixed by the end of the year

  • Improve and release other social tools — Comments, QuizGame, PictureGame, Video...there are plenty of awesome social extensions that need to be cleaned up and released



Do you have a wiki running SocialProfile? What features would you like to see incorporated in SocialProfile? Have some other thoughts, ideas or comments? Please let me know in the comments section.

Sunday, February 28, 2010

The past, the present and the future of the social tools

Social tools is a term which usually refers to MediaWiki's SocialProfile extension. SocialProfile consists of 10 "modules" (which actually used to be separate extensions at some point, ages ago), of which 9 are enabled by default. The only module not enabled by default is UserWelcome, which provides the <welcomeUser /> tag. Here's a quick overview of SocialProfile's modules:


  • SystemGifts — award functionality. Awards are automatically given out by the software once the user has reached the specified threshold (i.e. 5 edits, for example).

  • UserActivity — social activity feed on user profile pages.

  • UserBoard — Facebook-like message boards on user profile pages.

  • UserProfile — turns plain old User: pages into cool, social profiles!

  • UserRelationship — friends and foes, which will be shown in your social profile.

  • UserStats — statistics related to social actions (i.e. friending, sending a board message, etc.). UserStats also contains the point system (User Levels)

  • UserSystemMessages — required by UserActivity, stores when a user advanced to the next level

  • UserWelcome — a parser hook extension which provides <welcomeUser /> tag, which can be used to display user-specific info to the current user (when used in combination with WikiTextLoggedInOut extension

  • YUI — a very simple extension which loads the Yahoo! User Interface JavaScript library (version 2.7.0) on every page load, along with some custom functions.



In addition to SocialProfile and its modules, some other social tools are also available in the official MediaWiki SVN repository, namely:


  • RandomUsersWithAvatars — adds <randomuserswithavatars> tag to show the avatars of randomly chosen wiki users who have set an avatar for themselves.

  • WikiTextLoggedInOut — adds <loggedin> and <loggedout> parser tags to show different text to anonymous and logged-in users. Most commonly this is used to display random avatars (see RandomUsersWithAvatars extension) to anonymous users and UserWelcome info to registered users.



The past of social tools


Social tools were developed by the founders of ArmchairGM, Aaron Wright, David Pean, Dan Lewis and Rob Lefkowitz. Then Wikia bought ArmchairGM and hired its developers. Soon enough the magazine-style wikis were launched. Magazine wikis were wikis with social tools and each had its own, unique skin. Gaming.Wikia's was the best, no doubt — it was much like ArmchairGM's current default skin, only darker.
In late 2007, it seems that Wikia started pulling the plug on the magazine wikis. By 2008 there were no magazine wikis left, all of them had been converted into ordinary, plain Wikia wikis.

However, the social tools saw a second coming: Halopedia, a wiki about the popular Halo game series, was converted into a social wiki — complete with picture games, polls, quizzes and everything! I remember when that happened; I was helping the ArmchairGM developers in debugging the 'new' Halopedia.

In February 2008, SocialProfile was released, after I had requested it. At this point, it was lacking some essential features, such as the point system and the special page to remove other users' avatars (Special:RemoveAvatar). But...it was there. Completely open-source. You have to remember that back in 2008, Wikia wasn't an open-source project.

After this, a couple other wikis also got the Halo treatment: GamerGear, a wiki about PC and console gaming gear, Grand Theft Wiki, a wiki about the Grand Theft Auto game series and FFXIclopedia, a wiki about the Final Fantasy XI massively multiplayer online role-playing game (MMORPG).

The present of social tools


The ArmchairGM developers have either left Wikia voluntarily or been laid off, which, according to Wikia, means that there's nobody who knows the code.

Halopedia, GamerGear, Grand Theft Wiki and FFXIclopedia are still running social tools. Halopedia held two important votes in this January. As a result, polls, quizzes, picture games and social userboxes were turned off for Halopedia. Poll namespace extension is still enabled for Grand Theft Wiki, but it doesn't work — try clicking on one of the options of some poll and you'll see what I mean.

The future of social tools


I'm still the (un)official lead developer of SocialProfile extension, and I have no plans whatsoever to quit. Just yesterday Bryan, a fellow MediaWiki developer, fixed bug #22598 — now users using MediaWiki 1.16 or latest trunk can again upload their avatars.

I'm hoping to have more social features cleaned up by the end of the year. Namely, Comments, FanBoxes (social userboxes), LinkFilter, PictureGame, PollNY and QuizGame.

It will be a time-consuming task, I'm sure of that. But then again, I also believe in open source. I know that the social tools are a succeess, and so do the users. After all, what else explains that there are 4 archives of questions from users regarding this extension? :-)

Saturday, February 13, 2010

Idealism is dead

Back in January, I had an idea. A good one, I thought. Wikia operates ArmchairGM, a sports wiki where the social tools originated. My idea was to improve some of the unreleased tools, such as sports network tool. To do that, I needed to access the source code. Here's the catch: these tools are unreleased. Thus they cannot be found on Wikia's SVN.

What to do? On January 20, I emailed Jimmy Wales, the founder of Wikipedia and co-founder of Wikia, about this issue. My email was quickly forwarded to Gil Penchina, the CEO of Wikia, Inc. Long story short, I was asked to come to Wikia's office, either Poland or United States one, and sign a non-disclosure agreement (NDA) in order to gain access to the ArmchairGM source code and be allowed to clean it up. Wikia even offered to pay for the expenses and meals.
I wouldn't have minded signing a NDA, but flying to another country is just not possible for me, at least not anytime soon. I thought I had found a solution: I have a friend who lives in Poland and also is a programmer, so I thought that he could go to Wikia's office. I informed Wikia about this idea, and their reply to this was, "Sure". A few days later they inform us that "I can't let some "guy off the street" we've never met or built a relationship with get that sort of access to our internal systems".

Now, here's the thing: my friend's not just some guy off the street, but a smart programmer who's more experienced in programming than I'll probably ever be. He has a Master's degree and he's trusted in many different places, both offline and online. The major difference between him and me is that I once had global administrator rights on Wikia and he didn't. Big whoppin' deal.

My motive in this whole deal was to help out the greater community -- other users of MediaWiki and fellow MediaWiki developers. So that they'd have the largest possible pool of code to choose from. ArmchairGM's social tools are truly unique, as is its skin. I believed that I could change the world -- just a little, but for the better. Apparently that was a stupid idea. Should I just scrap my skin system rewrite project then, too?

Because Wikia thinks that ArmchairGM is a failed project, they aren't willing to clean up the code themselves. This means that a great skin and many great extensions have been lost forever...unless a developer in PoznaƄ or San Francisco area is willing to negotiate with Wikia. Anyone up for a challenge?

Wednesday, December 23, 2009

Answers, answers...answers?

It seems that Wikia is not very willing to discuss when they will release the missing parts of answer.wikia codebase — if ever. Wikia's contact form a.k.a Special:Contact is more or less of an alias to /dev/null. It's a shame, really. In my opinion, it's important to allow the users to participate if they want to do so. Now all the users can do is provide feedback and make suggestions. Surely it'd be better if the users could just take a look at the source code and fix the bugs they've found?

I've probably said it before, but I'll say it again just to make sure: it's not my problem if you're running your site(s) on a collection of hacks and quick patches. I've already offered my help and I know when it's not wanted. I just thought that it would've been nice to have an open-source answers platform for MediaWiki (since WikiAnswers is not open source) and it would've helped Wikia too, allowing better internationalization and more bug fixes.

Also, Merry Christmas to my readers — have an open-sourcey Christmas. ;-)

Sunday, August 23, 2009

Broken users

Special:BrokenRedirects is one of MediaWiki's most interesting - and, ironically enough, probably one of its most broken - special pages. It lists "broken" redirects - i.e. if the target doesn't exist but a page redirects there, the page is considered to be a broken redirect. What's interesting is that it considers interwiki redirects also "broken" in cases where interwiki redirecting isn't enabled.

But interwiki redirects are not broken redirects. The software has no (easy) way of checking - or if it does, it's not used - whether the page on the target wiki exists or not, so it just assumes that it's a broken redirect. This is probably why people use silly "soft redirect" templates.

Soft redirects are - at least in my opinion - pointless. Interwiki redirects are not broken redirects. If you, as an editor, cannot tell the difference between a redirect to a nonexistent page and a redirect to another wiki, then the only one who is broken is you. Not the software and most certainly not the redirect.

So why do I even care? Because:

  • soft redirects are pointless

  • I used to use interwiki redirects *a lot* during my time at Wikia and I absolutely hate getting notifications about new messages on some random wiki I haven't edited more than once



Seriously, just because you don't understand it doesn't mean that it's broken.

Saturday, August 15, 2009

The unanswered questions

Some time ago Wikia relaunched answers.wikia, their questions & answers site. It looked (and still looks) quite nice, so I was wondering how they did it. I looked into their SVN and found something related to the project. A skin, some extensions, some maintenance scripts...but one crucial thing was missing: a class called "Answers". The skin used functions provided by this missing class, which meant that the skin wouldn't work properly without the class.

What should I do? I decided to ask Wikia about the issue on their Q & A site. That's what it's for, right? The original answer to my question was quite vague. So I decided to reword my question a bit. This time I got a better answer: I was told to contact Wikia if I wanted to develop the source code (ah, Special:Contact, how much I love thee!).

Being the nice person I am, I sent in a polite request regarding the matter. I soon got a reply from a staff member who wrote that they'll be making sure that this report ends up to the right people. That was on May 21, 2009. I waited for over a month for something to happen regarding the matter, but nothng happened, so I decided to pay a visit to their IRC channel, #wikia. I was told that the IRC channel is not the place to get support (wtf?) and that the ticket -- my request -- has been forwarded to another person. The person I talked to refused to even tell who this "another person" in question is!

On August 9, 2009 I sent in another request through Special:Contact. The request was short and sweet: "rt#15912 needs some love." The ticket in question, rt#15912, is the one I sent back in May. This time I got a reply from a different staff member and they told me who this mysterious "another person" in question is. I'm supposed to discuss with this person about the source code of answers.wikia project.

But...why should I, really? There's nothing to discuss about, really. If Wikia is truly an open source project, then they should get a developer to commit those missing files. Typing "svn commit -m"adding missing files" file1.php file2.php fileN.php" in command line is not rocket science. Or then I'm a rocket scientist, as are my co-developers.

An anonymous user of answers.wikia (who, for the curious minds, isn't me) speculated that speculated that the delay in publishing the source code is intentional, in order to prevent competitors. I bet that if someone wanted to set up a competiting site, they'd just buy AnswerScript or something similar instead of using MediaWiki extensions and patches.

People should stop thinking open source as a threat and start thinking it as an opportunity.

Thursday, October 2, 2008

Code reviewing made easy

Services such as Google Code have offered code reviewing tools as a part of their service. Their code review tool is so great that even Wikia uses it. Nothing like that has ever been available for MediaWiki...until now.

CodeReview is a MediaWiki extension by Brion Vibber, Aaron Schulz, Alexandre Emsenhuber and Chad Horohoe that provides a code review tool for MediaWikis. You can see a live demo on MediaWiki.org. Privileged users can "tag" commits as "ok", "fixme" and so on and (by default) everyone can comment on commits. Sure, it isn't as fancy as Google Code's (yet anyway ;-), but it's nice to have a "native" solution rather than having to use Google's or some other provider's services. Currently CodeReview extension seems to be requiring at least MediaWiki 1.13 or 1.14alpha and didn't work for me under 1.13alpha.

If you find yourself emailing your fellow co-committers more than often and you just happen to operate a MediaWiki instance, maybe you'd want to check out this extension. Granted, CodeReview isn't perfect and there still are a couple things that the developers would like to see fixed. But trust me, it's quite good start for a code review tool for MediaWiki. I'd most certainly recommend trying it out if you have some moments, a MediaWiki and a SVN to spare.

Sunday, September 7, 2008

The wonders of PHP programming

I decided to update my working copy of regexBlock extension and finish up some work I started doing a long time ago - integrating changes from Wikia's SVN.

Everything looked nice until the update finished. I've got not only one but two files in conflicted state. I fix them and svn up again. Now I've got a clean-ish working copy and I can retry applying the Wikia modifications to my local copy.

One of the major annoyances of Wikia codebase is EasyTemplate class. The class supposedly allows "for easy mixing [of] HTML/JavaScript/CSS/PHP code". If you've ever written code for MediaWiki or taken a look at MediaWiki's source code, you're aware of public function addHTML in OutputPage.php. It does exactly what Wikia's EasyTemplate does, and even a bit easier IMO.

So the first thing I had to do to get the new regexBlock code working was to kill the EasyTemplate dependency. Thankfully that's about the easiest task there can be. Just replace the code referring to EasyTemplate with $wgOut->addHTML( 'code goes here' ); and that's almost about it (not quite, but let's not get into too technical details). Now I've got a working version of the extension in front of me, yay! Time to test it, so I'll add the extension into the LocalSettings.php of my local testing wiki, add the required tables to the database and go to the wiki to see any and all possible issues.

Okay, the special page loads, although the interface looked like as if there was at least one unclosed <div> tag. And then there was something other noteworthy too: one PHP notice (E_NOTICE) and one PHP warning (E_WARNING). The notice was about an "invalid argument supplied to foreach() on line..." and the warning was about an error within a function that used PHP's array_combine function. The warning related to array_combine function was actually very easy to fix, although I could've sworn that the first, obvious and correct fix didn't work the first time I tried it. After a while of trying, the error went away. That was the easy part of the upgrade...

What was remaining was the notice about an invalid argument to some foreach loop. It sounds relatively easy now, doesn't it? It certainly wasn't such. The current code (which does not raise any notices or errors) looks like this:


$selected = htmlspecialchars( ($k == $this->mRegexBlockedExpire) ) ? 'selected="selected"' : '';
foreach( $expiries as $k => $v ) {
$wgOut->addHTML('<option value="'.$selected.'">'.htmlspecialchars($v).'</option>');
}



But when I had moved the code to the main .php file from the template file, I had pretty much copy-pasted parts of the code and it looked like this:


foreach( $expiries as $k => $v ) {
$wgOut->addHTML('<option value="'.htmlspecialchars( ($k == $this->mRegexBlockedExpire) ) ? 'selected="selected"' : ''.'">'.htmlspecialchars($v).';</option>');
}



I do understand the people that hate PHP a bit better now. After I had fixed a couple errors like this, the interface worked relatively nicely.
Of course, I had to fix a couple message names - internationalization (i18n) support was added for regexBlock ages ago, but Wikia had added i18n on their own, which led to a new issue: a message containing some string, say, "permanent block" was called 'regexblock_permament_block' (sic) in Wikia's version and 'regexblock-view-block-infinite' in the official version.
Well, this was relatively easy task to be honest. After all, I only had to compare the two i18n files against each other and alter the message names in SpecialRegexBlock.php.

So, now what? Now I had a working, improved version of regexBlock extension that is error-free. Or that's what I thought myself. I tested the actual blocking mechanism and whoops:


Expiry time invalid.


No wonder that there are comments like "Fuck you, PHP. Fuck you in the ear!" around the MediaWiki codebase.

So, it's back to the drawing board for me, so to say. Maybe I'll have this extension upgrade finished before Christmas 2008, who knows.

Tuesday, September 2, 2008

New blog

It's been a while since I've had a blog. Rather, a long while. I've never really understood the secret of blogging and why so many people keep their own blogs...well, maybe things would change now.

Assuming you remember my old blog, I really didn't have the time or interest required in updating it. And I've always preferred MediaWiki. Granted, I'm a MediaWiki developer nowadays and thus it's kinda obvious why I'm so biased towards MediaWiki than anything else.

I've also enabled anonymous commenting on this blog. Nevertheless, I suppose that almost everyone has a Google account that they can use to comment. However, this is a privilege granted to you — please don't abuse it.

If you need to contact me privately, feel free to email me at jack@countervandalism.net. You're free to post MediaWiki-related questions on my MediaWiki.org user talk page. I'd strongly suggest asking on IRC & mediawiki-l / wikitech-l for help though, because many experienced developers and users monitor those.