Hi, This is my first contribution to WikiMedia, so please forgive me(and tell me what to do in the future) if this is the wrong list for patches, or I have not correctly followed your coding style conventions.
The patch makes config/index.php work out of the box(before it failed with a database error). To get this to work, I had to make LoadBalancer.php honour $wgUseDatabaseMessages = false(the code is only run if the database connection has already failed, so there is no slowdown except in error situations). I also had to modify User.php so that a wgDebugDieBacktrace is not called when $wgUseDatabaseMessages = false. Again, this does not affect the "usual" path of execution. I added a $dbr == null check in Group.php, this does affect the usual path of execution, but is probably a check we should have anyway.
I also fixed some old and/or unnecessary code in config/index.php
Patch follows(-rbud options): cvs diff: Diffing config Index: config/index.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/config/index.php,v retrieving revision 1.89 diff -b -u -d -r1.89 index.php --- config/index.php 28 Dec 2004 14:49:41 -0000 1.89 +++ config/index.php 15 Jan 2005 00:17:12 -0000 @@ -405,7 +405,6 @@ $wgDBadminuser = "root"; $wgDBadminpassword = $conf->RootPW; $wgDBprefix = $conf->DBprefix; - $wgCommandLineMode = true; $wgUseDatabaseMessages = false; /* FIXME: For database failure */ require_once( "includes/Setup.php" ); chdir( "config" ); @@ -414,7 +413,7 @@
$wgTitle = Title::newFromText( "Installation script" ); $wgDatabase = Database::newFromParams( $wgDBserver, "root", $conf->RootPW, "", 1 ); - $wgDatabase->mIgnoreErrors = true; + $wgDatabase->ignoreErrors(true);
@$myver = mysql_get_server_info( $wgDatabase->mConn ); if( $myver ) { @@ -436,7 +435,7 @@ $wgDBadminpassword = $wgDBpassword; $wgDatabase = Database::newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, "", 1 ); $wgDatabase->isOpen(); - $wgDatabase->mIgnoreErrors = true; + $wgDatabase->ignoreErrors(true); @$myver = mysql_get_server_info( $wgDatabase->mConn ); if( !$myver ) { $errs["DBuser"] = "Check name/pass"; @@ -1104,6 +1103,9 @@
$wgProxyKey = "$proxyKey";
+# The whitelist +$wgWhitelistRead = array("Special:Userlogin"); + ## Default skin: you can change the default skin. Use the internal symbolic ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook': # $wgDefaultSkin = 'monobook'; cvs diff: Diffing docs cvs diff: Diffing docs/html cvs diff: Diffing docs/php-memcached cvs diff: Diffing extensions cvs diff: Diffing images cvs diff: Diffing includes Index: includes/Group.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/Group.php,v retrieving revision 1.2 diff -b -u -d -r1.2 Group.php --- includes/Group.php 24 Oct 2004 22:02:02 -0000 1.2 +++ includes/Group.php 15 Jan 2005 00:17:24 -0000 @@ -131,6 +131,8 @@ function nameFromId($id) { $fname = 'Group::nameFromId'; $dbr =& wfGetDB( DB_SLAVE ); + if ($dbr == null) + return; $r = $dbr->selectRow( 'group', array( 'group_name' ), array( 'group_id' => $id ), $fname );
if($r === false) { Index: includes/LoadBalancer.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/LoadBalancer.php,v retrieving revision 1.17 diff -b -u -d -r1.17 LoadBalancer.php --- includes/LoadBalancer.php 6 Dec 2004 01:14:53 -0000 1.17 +++ includes/LoadBalancer.php 15 Jan 2005 00:17:31 -0000 @@ -320,8 +320,11 @@
function reportConnectionError( &$conn ) { + global $wgUseDatabaseMessages; $fname = 'LoadBalancer::reportConnectionError'; wfProfileIn( $fname ); + if (!$wgUseDatabaseMessages) + return; # Prevent infinite recursion
static $reporting = false; Index: includes/User.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/User.php,v retrieving revision 1.114 diff -b -u -d -r1.114 User.php --- includes/User.php 8 Jan 2005 09:17:33 -0000 1.114 +++ includes/User.php 15 Jan 2005 00:17:36 -0000 @@ -379,7 +379,7 @@ * Load a user from the database */ function loadFromDatabase() { - global $wgCommandLineMode, $wgAnonGroupId, $wgLoggedInGroupId; + global $wgCommandLineMode, $wgAnonGroupId, $wgLoggedInGroupId, $wgUseDatabaseMessages; $fname = "User::loadFromDatabase";
# Counter-intuitive, breaks various things, use User::setLoaded() if you want to suppress @@ -397,9 +397,15 @@ /** Get rights */ $anong = Group::newFromId($wgAnonGroupId); if (!$anong) - wfDebugDieBacktrace("Please update your database schema " - ."and populate initial group data from " - ."maintenance/archives patches"); + { + if ($wgUseDatabaseMessages) + wfDebugDieBacktrace( + "Please update your database ". + "schema and populate initial ". + "group data from maintenance/". + "archives patches"); + return; + } $anong->loadFromDatabase(); $this->mRights = explode(',', $anong->getRights()); $this->mDataLoaded = true;