r1533 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r1532‎ | r1533 | r1534 >
Date:10:08, 9 August 2003
Author:vibber
Status:old
Tags:
Comment:
Alternate db connect, use proper charset in abort page
Modified paths:
  • /trunk/phase3/includes/DatabaseFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DatabaseFunctions.php
@@ -5,7 +5,7 @@
66
77 $wgLastDatabaseQuery = "";
88
9 -function wfGetDB( $altuser = "", $altpassword = "" )
 9+function wfGetDB( $altuser = "", $altpassword = "", $altserver = "", $altdb = "" )
1010 {
1111 global $wgDBserver, $wgDBuser, $wgDBpassword;
1212 global $wgDBname, $wgDBconnection, $wgEmergencyContact;
@@ -18,7 +18,9 @@
1919 $wgEmergencyContact . "\">Wikipedia developers</a>.</p>";
2020
2121 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 )
2325 or die( "bad sql user" );
2426 mysql_select_db( $wgDBname, $wgDBconnection ) or die(
2527 htmlspecialchars(mysql_error()) );
@@ -35,7 +37,7 @@
3638 @$wgDBconnection = mysql_connect( $wgDBserver, $wgDBuser, $wgDBpassword )
3739 or wfEmergencyAbort();
3840
39 - @mysql_select_db( $wgDBname, $wgDBconnection )
 41+ @mysql_select_db( $db, $wgDBconnection )
4042 or wfEmergencyAbort();
4143 }
4244 }
@@ -46,8 +48,9 @@
4749 /* Call this function if we couldn't contact the database...
4850 We'll try to use the cache to display something in the meantime */
4951 function wfEmergencyAbort( $msg = "" ) {
50 - global $wgTitle, $wgUseFileCache, $title;
 52+ global $wgTitle, $wgUseFileCache, $title, $wgOutputEncoding;
5153
 54+ header( "Content-type: text/html; charset=$wgOutputEncoding" );
5255 if($msg == "") $msg = wfMsg( "noconnect" );
5356 $text = $msg;
5457

Status & tagging log