Donate.wikimedia.org

From Wikitech

donate.wikimedia.org is typically the location of the first form elements a user will see while moving through the donation pipeline, or first-step forms. In more recent history, donate has been replaced entirely by adding the content usually found on a first-step form directly to CentralNotice fundraising banners.

Chapter Redirects

donate.wikimedia.org is set up to redirect users to some chapter fundraising sites. The users which are redirected are done by country of origin. The code that controls this behavior unfortunately lives in a couple different places, presumably to cover different states in the donation pipeline. This is fairly annoying when trying to change that list of chapter redirects. The fact that these things are defined in two different parallel extensions suggests that they should both be refactored, as defining identical configured behaviors in two places is for chumps.

Changing Chapter Redirects

Changing the list of countries that will trigger a chapter redirect will require a cluster deploy, with edits that touch both the FundraiserLandingPage and LandingCheck extensions.

Note: Please comment early and often everywhere you make changes which will affect chapter redirects. There is a huge potential here for unintended drama if something goes amiss.

  • If you remove countries, comment them out rather than deleting them, and add a comment with the date and justification.
  • If you add (or uncomment) countries, make sure there is an associated comment with the date and justification for the new redirect.

FundraiserLandingPage Extension Changes

$wgFundraiserLandingPageChapters is a global variable that contains an array of 2-character country codes, and the link to which they should redirect. The keys are country codes intended to trigger a chapter redirect, mapping to values which correspond to a mediawiki message label defined in the i18n file (Yeah... we know :( ), which contains the link to the chapter's fundraising page.

Note: While $wgFundraiserLandingPageChapters is a global variable that could be overridden in LocalSettings, we have so far chosen to make these changes in the actual extension code and push the whole thing, probably because of the requisite label definitions that must be done in the i18n files for new countries.

LandingCheck Extension Changes

$wgPriorityCountries contains an array of two-character country codes which will cause LandingCheck to retrieve the relevant chapter redirect and send the user there. If a country exists in the LandingCheck array, and there is no redirect link defined in FLP, it will dead-end with a LandingCheck message that says "No pages were found while performing the request." (See localRedirect function)

It seems that LandingCheck is also used as an early gate for countries from which the wikimedia foundation can not currently accept donations. The desired behavior in that case seems to be to present the "no pages" error page from above.