Last modified: 2011-05-21 18:19:11 UTC
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 :)
$wgDBprefix is the prefix of the local database, so it is not used when using a foreign database, you need to pass it in the third parameter of wfGetDB() by separing it from the database name with a dash, so in you case you should set $wgCentralDBname to 'mw_trunk-mw_'.