Page MenuHomePhabricator

Add dry-run option to populateProjectsFromSiteMatrix.php script in ReadingLists
Open, Needs TriagePublic

Description

There is a maintenance script populateProjectsFromSiteMatrix.php to add projects to the reading_list_project table.

It would be helpful to have a --dry-run option to check what the script would be doing in any given run.

Once we are confident that the script works well, we should add it to steps for setting up a new Wikimedia project in production.

This script is needed to populate missing wikis, and help fix T428002.

Requirements

  • Add a --dry-run option that outputs the list of projects that would be inserted

Technical notes

The script requires the SiteMatrix extension.

Locally, I have a wikifarm setup which works with SiteMatrix:

$wgLocalDatabases = [ 'enwiki', 'commonswiki', ... ];
$wgConf->wikis = $wgLocalDatabases;
$wgConf->suffixes = [ 'wiki' ];

Event Timeline

Also the script is using waitForReplication which is deprecated and it was waiting for replication after every insert (vs every batch)

With the --dry-run option added:

I deleted the project belows from my reading_list_project table and then ran the script with --dry-run:

MW_DB=enwiki php maintenance/run.php ReadingLists:PopulateProjectsFromSiteMatrix  --dry-run
would insert 6 projects
https://itwiki.mediawiki.local.wmftest.net
https://jawiki.mediawiki.local.wmftest.net
https://kowiki.mediawiki.local.wmftest.net
https://nlwiki.mediawiki.local.wmftest.net
https://ptwiki.mediawiki.local.wmftest.net
https://viwiki.mediawiki.local.wmftest.net

Then without dry-run, it added the projects back to the database.

Change #1297187 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Add --dry-run option to populateProjectsFromSiteMatrix.php

https://gerrit.wikimedia.org/r/1297187

Change #1297187 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Add --dry-run option to populateProjectsFromSiteMatrix.php

https://gerrit.wikimedia.org/r/1297187