Index: trunk/phase3/includes/DatabaseFunctions.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | |
7 | 7 | $wgLastDatabaseQuery = ""; |
8 | 8 | |
9 | | -function wfGetDB( $altuser = "", $altpassword = "" ) |
| 9 | +function wfGetDB( $altuser = "", $altpassword = "", $altserver = "", $altdb = "" ) |
10 | 10 | { |
11 | 11 | global $wgDBserver, $wgDBuser, $wgDBpassword; |
12 | 12 | global $wgDBname, $wgDBconnection, $wgEmergencyContact; |
— | — | @@ -18,7 +18,9 @@ |
19 | 19 | $wgEmergencyContact . "\">Wikipedia developers</a>.</p>"; |
20 | 20 | |
21 | 21 | if ( $altuser != "" ) { |
22 | | - $wgDBconnection = mysql_connect( $wgDBserver, $altuser, $altpassword ) |
| 22 | + $serve = ($altserver ? $altserver : $wgDBserver ); |
| 23 | + $db = ($altdb ? $altdb : $wgDBname ); |
| 24 | + $wgDBconnection = mysql_connect( $serve, $altuser, $altpassword ) |
23 | 25 | or die( "bad sql user" ); |
24 | 26 | mysql_select_db( $wgDBname, $wgDBconnection ) or die( |
25 | 27 | htmlspecialchars(mysql_error()) ); |
— | — | @@ -35,7 +37,7 @@ |
36 | 38 | @$wgDBconnection = mysql_connect( $wgDBserver, $wgDBuser, $wgDBpassword ) |
37 | 39 | or wfEmergencyAbort(); |
38 | 40 | |
39 | | - @mysql_select_db( $wgDBname, $wgDBconnection ) |
| 41 | + @mysql_select_db( $db, $wgDBconnection ) |
40 | 42 | or wfEmergencyAbort(); |
41 | 43 | } |
42 | 44 | } |
— | — | @@ -46,8 +48,9 @@ |
47 | 49 | /* Call this function if we couldn't contact the database... |
48 | 50 | We'll try to use the cache to display something in the meantime */ |
49 | 51 | function wfEmergencyAbort( $msg = "" ) { |
50 | | - global $wgTitle, $wgUseFileCache, $title; |
| 52 | + global $wgTitle, $wgUseFileCache, $title, $wgOutputEncoding; |
51 | 53 | |
| 54 | + header( "Content-type: text/html; charset=$wgOutputEncoding" ); |
52 | 55 | if($msg == "") $msg = wfMsg( "noconnect" ); |
53 | 56 | $text = $msg; |
54 | 57 | |