The page talks about using a custom script ("Insert wiki family (using Script)"). I have just used the populateSitesTable.php script running it once for each wiki ID, and it successfully populated the sites table for each language wiki with a list of default wiki sites. Now I think I need to add my own wiki to this list in order to be able to use the "add link" feature for any given page. Where would I use the suggested script? Do I create a php file somewhere? Or add this within another script such as addSite.php
?
$sites = [];
foreach ( [ 'en', 'fr' ] as $langCode ) {
$site = new MediaWikiSite();
$site->setGlobalId( $langCode . 'mywiki' );
$site->setGroup( 'mywiki' );
$site->setLanguageCode( $langCode );
$site->addInterwikiId( $langCode );
$site->addNavigationId( $langCode );
$site->setPath( MediaWikiSite::PATH_PAGE, "http://$langCode.mywiki.org/wiki/$1" );
$site->setPath( MediaWikiSite::PATH_FILE, "http://$langCode.mywiki.org/w/$1" );
$sites[] = $site;
}
$sitesTable = SiteSQLStore::newInstance();
$sitesTable->clear(); // This will remove all previous entries from the table. Remove this call if you want to keep them.
$sitesTable->saveSites( $sites );
Obviously switching out "mywiki" with my own wiki namespace.