Last modified: 2014-11-12 08:57:12 UTC
GlobalUsage uses functions for finding the names of the wikis and the links to the pages which depend on the database naming convention used by Wikimedia. This makes the extension only limited usable outside the Wikimedia wikis. The functions used are WikiMap::getWikiName and WikiMap::getForeignUrl from the WikiMap Class. An alternative that doesn't depend on the database naming convention used by Wikimedia are the functions in the Interwiki Class.
Created attachment 16440 [details] A possible fix A possible fix that is in use on the wikis of the ScoutWiki Network: http://www.scoutwiki.org.
An other site with the same problem: https://www.mediawiki.org/wiki/Extension_talk:GlobalUsage#Change_display_23718 http://mywiki.everythingfoodanddrink.org/wiki/File:GlobalUsage_screenshot.jpg
Im not sure what this has to do with naming conventions. GlobalUsage should use whatever names are in the $wgLBFactoryConf and $wgConf. If those configuration variables are not set properly, you will get errors like above. (Yes i am aware that they are slightly confusing config settings...)
(In reply to Bawolff (Brian Wolff) from comment #3) > Im not sure what this has to do with naming conventions. GlobalUsage should > use whatever names are in the $wgLBFactoryConf and $wgConf. > > If those configuration variables are not set properly, you will get errors > like above. (Yes i am aware that they are slightly confusing config > settings...) The problem is that deep down GlobalUsage uses functions like these: WikiMap::getWiki WikiReference::getDisplayName - Get the the URL in a way to de displayed to the user More or less Wikimedia specific. Those functions only give correct results if the database names are like enwiki, lang suffix, but not if your database names are like wikien, wiki_en or something completely different.
(In reply to egel from comment #4) > > The problem is that deep down GlobalUsage uses functions like these: > WikiMap::getWiki > WikiReference::getDisplayName - Get the the URL in a way to de displayed to > the user More or less Wikimedia specific. > > Those functions only give correct results if the database names are like > enwiki, lang suffix, but not if your database names are like wikien, wiki_en > or something completely different. Well that may be the default, can't you just override that by doing something like: function wfGetWikiType( SiteConfiguration $conf, $wiki ) { // Do whatever you need to do to figure out lang etc return( array( 'lang' => $whateverLanguageIs, 'suffix' => $whateverWikiFamilyIs ) ); } $wgConf->siteParamsCallback = wfGetWikiType; [That example is untested, I could have mistyped something or misunderstood something]
(In reply to Bawolff (Brian Wolff) from comment #5) > (In reply to egel from comment #4) > > > > > The problem is that deep down GlobalUsage uses functions like these: > > WikiMap::getWiki > > WikiReference::getDisplayName - Get the the URL in a way to de displayed to > > the user More or less Wikimedia specific. > > > > Those functions only give correct results if the database names are like > > enwiki, lang suffix, but not if your database names are like wikien, wiki_en > > or something completely different. > > Well that may be the default, can't you just override that by doing > something like: > > function wfGetWikiType( SiteConfiguration $conf, $wiki ) { > // Do whatever you need to do to figure out lang etc > return( array( 'lang' => $whateverLanguageIs, 'suffix' => > $whateverWikiFamilyIs ) ); > > } > > $wgConf->siteParamsCallback = wfGetWikiType; > > [That example is untested, I could have mistyped something or misunderstood > something] Case in point, the last line should be, $wgConf->siteParamsCallback = 'wfGetWikiType';
Our farm uses CommonSettings.php and InitialiseSettings.php We already tried this: # ---------------------------------------------------------------------- # Initialisation $wgLocalDatabases = array( 'scoutwiki_ar', 'scoutwiki_cs', 'scoutwiki_da', 'scoutwiki_de', 'scoutwiki_en', 'scoutwiki_eo', 'scoutwiki_fi', 'scoutwiki_fr', 'scoutwiki_it', 'scoutwiki_nl', 'scoutwiki_pt', 'scoutwiki_sv', 'scoutwiki_uk', 'scoutwiki_asso', 'scoutwiki_media', ); $wgConf->wikis = $wgLocalDatabases; $wgConf->prefixes = array( 'scoutwiki' ); $wgConf->localVHosts = array( 'localhost' ); require_once "$IP/sites/InitialiseSettings.php"; function efGetSiteParams( $conf, $wiki ) { $site = null; $lang = null; foreach( $conf->prefixes as $prefix ) { if ( substr( $wiki, 0, strlen( $prefix ) ) == $prefix ) { $site = $prefix; $lang = substr( $wiki, strlen( $prefix ) + 1 ); break; } } return array( 'suffix' => $site, 'prefix' => $site, 'lang' => $lang, 'params' => array( 'lang' => $lang, 'site' => $site, 'wiki' => $wiki, ), 'tags' => array(), ); } $wgConf->prefixes = $wgLocalDatabases; $wgConf->suffixes = $wgLocalDatabases; $wgConf->siteParamsCallback = 'efGetSiteParams'; $wgConf->extractAllGlobals( $wgDBname ); # ----------------------------------------------- The result is: the site names are empty and the image links link to the local wiki.