The intent is to allow us to generate site info files (like P3044) from old CDB files or from the interwiki table, as well as to convert between different representations of site info. Some examples:
To migrate from a CDB file as generated by dumpInterwiki.php to the php used for SiteLookup:
convertSiteInfo.php interwiki:cdb:/foo/bar.cdb sites:php:/foo/bar.php
To dump the content of the sites table as JSON:
convertSiteInfo.php sites:db sites:json:/foo/bar.json
To dump the content of the interwiki table as JSON:
convertSiteInfo.php interwiki:db sites:json:/foo/bar.json
To convert from old-style sites JSON to new style JSON, with pre-computed indexes:
convertSiteInfo.php sites:json:/foo/bar-old.json sites:json:/foo/bar.json --index
To combine multiple php and json files into a single php file:
convertSiteInfo.php sites:json:foo.json sites:php:bar.php sites:json:combined.php
The way the sources and destinations are specified in the examples above are a bit ad-hoc and possibly unnecessary. The file extension should be sufficient in most cases: .cdb will trigger the classic interwiki code with a SiteLookup-adapter to be used for reading; .json will trigger a SiteLookup to be used (which should support the old as well as the new json structure). .php will also be read by a SiteLookup. For output, only the new style JSON and PHP structures would be supported, using T135156: Create a SiteStore that can write JSON and PHP files. We'll need some special syntax to indicate that we want to read from the interwiki or the sites table, though.