$wgDBmysql4 = false; # Set to true to use enhanced fulltext search
$wgSqlTimeout = 30;
+# Other wikis on this site, can be administered from a single developer account
+# Array, interwiki prefix => database name
+$wgLocalDatabases = array();
+
# Database load balancer
$wgDBservers = false; # e.g. array("larousse", "pliny")
$wgDBloads = false; # e.g. array(0.6, 0.4);
function doSubmit()
{
global $wgOut, $wgUser, $wgLang, $wpMakesysopUser, $wpSetBureaucrat;
- global $wgDBname, $wgMemc, $wpRights;
+ global $wgDBname, $wgMemc, $wpRights, $wgLocalDatabases;
$parts = explode( "@", $wpMakesysopUser );
if( count( $parts ) == 2 && $wgUser->isDeveloper() ){
- $username = addslashes( $parts[0] );
- $usertable = $parts[1] . "wiki.user";
- $dbName = $parts[1] . "wiki";
+ $username = wfStrencode( $parts[0] );
+ if ( array_key_exists( $parts[1], $wgLocalDatabases ) ) {
+ $dbName = $wgLocalDatabases[$parts[1]];
+ $usertable = $dbName . ".user";
+ } else {
+ $this->showFail();
+ return;
+ }
} else {
- $username = addslashes( $wpMakesysopUser );
+ $username = wfStrencode( $wpMakesysopUser );
$usertable = "user";
$dbName = $wgDBname;
}
$prev = wfIgnoreSQLErrors( TRUE );
- $res = wfQuery("SELECT user_id, user_rights FROM user WHERE user_name = '{$username}'", DB_WRITE);
+ $res = wfQuery("SELECT user_id, user_rights FROM $usertable WHERE user_name = '{$username}'", DB_WRITE);
wfIgnoreSQLErrors( $prev );
if( wfLastErrno() || ! $username || wfNumRows( $res ) == 0 ){
if ( count( $rightsNotation ) == 0 ) {
$this->showFail();
} else {
- $sql = "UPDATE user SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1";
+ $sql = "UPDATE $usertable SET user_rights = '{$newrights}' WHERE user_id = $id LIMIT 1";
wfQuery($sql, DB_WRITE);
- $wgMemc->delete( "$wgDBname:user:id:$id" );
+ $wgMemc->delete( "$dbName:user:id:$id" );
$bureaucratLog = wfMsg( "bureaucratlog" );
$action = wfMsg( "bureaucratlogentry", $wpMakesysopUser, implode( " ", $rightsNotation ) );