https://bugzilla.wikimedia.org/show_bug.cgi?id=29074

       Web browser: ---
             Bug #: 29074
           Summary: DB table prefix problem when specifying DB in wfGetDB
           Product: MediaWiki
           Version: 1.19-svn
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Database
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


I just had a go at installing Central Notice on my local wiki and discovered it
fails pretty hard when you are using DB table prefixes. I've done some
debugging an one particular issue seems to be in wfGetDB. I'm getting this
error:

The last attempted database query was: SELECT tmp_name FROM `cn_templates`
WHERE tmp_name = '2011EditorSurvey' LIMIT 1 from within function
"DatabaseBase::selectRow". Database returned error "1146: Table
'mw_trunk.cn_templates' doesn't exist (localhost)".

Which is coming from this code:

$dbr = wfGetDB( DB_SLAVE,  array(), $wgCentralDBname );
$row = $dbr->selectRow( 'cn_templates', 'tmp_name',  array( 'tmp_name' =>
$eTemplateName ) );

The wrong thing in the query is that it's selecting from mw_trunk.cn_templates,
while I have the prefix "mw_", so it should be mw_trunk.mw_cn_templates.
Apparently the $wgDBprefix does not get added when specifying the db in
wfGetDB. Commenting out this argument in the above code results in a correct
query (and no error).

No sure what the idea here is, and I'm not familiar with the DB code, so I'm
reporting this instead of trying to fix it myself :)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to