Writing an extension for deployment

This page documents instructions for writing a MediaWiki extension for deployment on Wikimedia wikis.

As you can see from Special:Version, many people have written extensions that then got deployed on Wikimedia sites. Most of them didn't work for the Wikimedia Foundation. In 2011 and 2012 the process had a bottleneck as extensions sat awaiting code review for months at a time, but we're hoping to speed that up by separating the "should WMF sites get this feature?" evaluation step from the "does this code work and perform well?" step, and by better integrating extensions review into WMF engineers' community service time.

Design review
Whether you have already written the extension or it's just an idea, talk to a Wikimedia Foundation product manager. Your first stop is Howie Fung, the director of product management. Tell him your idea and ask whether it's something that Wikimedia Foundation sites should have. This will start a conversation about the design of your feature.

This design review phase may take weeks, or even months, but its aim is to make sure that Wikimedia readers, editors, and contributors have a great user experience.

If he doesn't respond in about a week, or if the process stalls, ask Sumana Harihareswara, Volunteer Development Coordinator, to poke him.

As you continue the conversation, you should use your judgment on whether to write code as you go, or wait till the conversation's reached some consensus on design.

Code location and internationalization
Extensions that will be deployed should be in Git. Get developer access if you don't already have it and put it in Git -- see Git/New repositories.

This gets the ball rolling on a technical level. The extension will need to be translated on Translatewiki before it can be deployed anywhere, and putting it in Git with the proper i18n files and such will make that happen fairly quickly.

It's a good idea to start documenting your extension, at this point, here on MediaWiki. The extension template is a good place to start.

Code review
You'll likely start to get reviews at this point for code style. You can get a jump on those by reading over Coding conventions, Pre-commit checklist, Performance tuning, and Security for developers and making sure that your code follows these guidelines.

Next, you should try to get two or more reviews by trusted developers. Find a couple of established MediaWiki hackers to look over your code and point out any flaws in it. If you don't yet know any other MediaWiki developers, ask in IRC, or on the developers' mailing lists. They will help you find anything that doesn't have a chance of making it past the next step. Make sure they know you're trying to follow this guide. If they know you're trying to get your code deployed, they'll look for things that would block deployment, or alternatives to deployment that you might not be aware of.

For example, they may point you to another extension that is already in use whose functionality duplicates what you want, or could be easily extended to do what you want. In that case, you should use your newly-acquired Git access to work on the extension that is already in use.

Review for deployment
After your code has been checked by a few developers and the issues have been resolved, file a bug in Bugzilla asking that the extension be reviewed and deployed by the release manager.

The bug should:
 * use the "shell" keyword so that people with shell access can find the request;
 * point to on-wiki community consensus for having the extension installed on a particular wiki, as necessary;
 * indicate that the extension hasn't been deployed to a Wikimedia wiki yet and ask the release manager to review it.

If you need help with that, poke the Bugmeister.

Also list the extension at Review queue with its bug number, and connect it to the extension review tracking bug by saying that your bug blocks bug 31235.

Anything that is deployed on the Wikimedia cluster needs to be reviewed by the release manager for security and scalability issues. Ask in IRC to find out who that is.

Any issues that the release manager identifies must be addressed before anyone can deploy your code on the cluster. If you've followed the advice of earlier reviewers closely, you probably won't have too much of a problem here. But the release manager takes his job very seriously, so he may well spot a show-stopper that eluded your earlier reviewers.

If everything appears ready for deployment, the extension should be moved from Review queue to Deployment queue. The release manager should do that.

Profit
Getting something deployed is not an easy task, but if you can meet the challenge, you know you've done something that not many people are capable of, and you'll improve millions of people's lives.