Last modified: 2014-11-12 08:57:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T72713, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 70713 - GlobalUsage of limited use on wikis that use an other database naming convention than Wikimedia's
GlobalUsage of limited use on wikis that use an other database naming convent...
Status: UNCONFIRMED
Product: MediaWiki extensions
Classification: Unclassified
GlobalUsage (Other open bugs)
unspecified
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-11 13:38 UTC by egel
Modified: 2014-11-12 08:57 UTC (History)
7 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
A possible fix (4.93 KB, patch)
2014-09-11 13:52 UTC, egel
Details

Description egel 2014-09-11 13:38:36 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.
Comment 1 egel 2014-09-11 13:52:17 UTC
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.
Comment 3 Bawolff (Brian Wolff) 2014-11-11 17:25:10 UTC
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...)
Comment 4 egel 2014-11-11 19:26:48 UTC
(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.
Comment 5 Bawolff (Brian Wolff) 2014-11-11 22:21:33 UTC
(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]
Comment 6 Bawolff (Brian Wolff) 2014-11-11 22:22:07 UTC
(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';
Comment 7 egel 2014-11-12 08:57:12 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links