User:SPage (WMF)/Duplicating mediawiki.org

From mediawiki.org

We need to prototype and demo the Data and developer hub with a different skin. So set up a labs instance and copy the files.

Settings[edit]

Also see wikitech:Nova_Resource:Developer-doc-devhub.developer-doc.eqiad.wmflabs#Configuration_notes

settings.d/10-misc.php[edit]

// https://www.mediawiki.org/wiki/Manual:$wgImportSources
$wgImportSources = array(
        'mediawikiwiki',
        'wikipedia',
);

$wgUseInstantCommons = true;

Need to add interwiki[edit]

From Special:WantedPage, I realized interwiki table lacks en, foundation, m, meta, mw, phab, w, wikidata, wikitech Copied from mw.org's Special:Interwiki to local Special:Interwiki.

Main Page[edit]

Edit MediaWiki:Mainpage to set the default page to the root of the imported pages, API:Web APIs hub. (Prior to 2015-07 the main page was Dev:Data_and_developer_hub but no longer using Dev: namespace, see discussion and phab:T369)

Importing[edit]

$wgImportSources let me "Import from another wiki" directly from mediawiki.org. By checking "Include all templates", I got a lot of dependent templates when I imported API:Data and developer hub

To get additional pages,

  1. I visited http://devhub.wmflabs.org/wiki/Special:WantedPages
  2. copy the text
  3. clean up whitespace, link text.
  4. exclude m:, w:, wikitech: , etc. -- these are interwiki prefixes I had not set up
  5. paste the list into Special:Export
    • do include templates, don't include history
  6. export as file

Then Special:Import this as "Upload XML data" onto my wiki. Generated a weird title error but imported some stuff.

Also imported Template:MW_version, etc.

Images[edit]

Most images are on commons. I added $wgUseInstantCommons = true;, and my wiki knows they come from there with correct links to upload.wikimedia.org, e.g. File:Wikipedia Beta search on Android 4.4.4 2015-02-09.png.

InstantCommons images broken with multi-wiki setup[edit]

Yet, I don't see the images locally. If I requested http://devhub.wmflabs.org/images/thumb/c/c9/Wikipedia_Beta_search_on_Android_4.4.4_2015-02-09.png , the image URL complained "/images/thumb/path/to/image.png" not found even though the file exists in /srv/mediawiki, I get

Error generating thumbnail
The source file 'Wikipedia_Beta_search_on_Android_4.4.4_2015-02-09.png' does not exist. . Permission problem?

It seems cirrussearch and mobilefrontend caused problems, these seem to trigger multiwiki behavior with multiple wiki settings in /Vagrant/settings.d/wikis/, including a /vagrant/settings.d/wikis/commonswiki/ directory. So I disabled these two roles.

Other images[edit]

With InstantCommons, most images from commons "just worked". Some images were only on mediawiki.org. Special:Import doesn't work for these, it imports the page information but not the media file. So wget original file and Special:Upload it, e.g. File:2015-03-16_RCStream_CodePen.png and File:Trail_shoe_rotated.svg

SVG support

Had to add 'svg' to $wgFileExtensions, see Manual:Configuring_file_uploads#Configuring file types.

Blueprint[edit]

I edited Blueprint.php to change the navigation TOC elements to 'Dev:Data and developer hub', etc., and edited src/BlueprintXx to not show the namespace of these links.

Roles[edit]

The pages on mediawiki.org use features provided by the following roles:

  • apisandbox, interwiki, parserfunctions, scribunto, translate, labeledsectiontransclude

Also enable

  • cirrussearch, mobilefrontend but these caused InstantCommons breakage above

Importing other API: pages required the inputbox extension (which doesn't have a role).