diff --git a/mozilla/webtools/bonsai/defparams.pl b/mozilla/webtools/bonsai/defparams.pl
index adb3b2fc847..5012a09229b 100644
--- a/mozilla/webtools/bonsai/defparams.pl
+++ b/mozilla/webtools/bonsai/defparams.pl
@@ -136,6 +136,11 @@ DefParam("cvsadmin",
"t",
'%maintainer%');
+DefParam("dbiparam",
+ "The first parameter to pass to the DBI->connect() method.
Example: DBI:mysql:host=localhost;database=bonsai",
+ "t",
+ "DBI:mysql:database=bonsai;");
+
DefParam("mysqluser",
"The username of the bonsai database user.",
"t",
@@ -146,16 +151,21 @@ DefParam("mysqlpassword",
"p",
"");
-DefParam("dbiparam",
- "The first parameter to pass to the DBI->connect() method.
Example: DBI:mysql:host=localhost;database=bonsai",
- "t",
- "DBI:mysql:database=bonsai;");
-
DefParam("shadowdbiparam",
"The first parameter to pass to the DBI->connect() method of a read-only replicated slave database to use for queries, to help with performance on high-traffic systems. If left blank, queries will be made against the primary database and this param will be ignored.
Example: DBI:mysql:host=slaveserver;database=bonsai",
"t",
"");
+DefParam("shadowmysqluser",
+ "The username of the bonsai database user for the shadow database.",
+ "t",
+ "nobody");
+
+DefParam("shadowmysqlpassword",
+ "The password of the bonsai database user for the shadow database.",
+ "p",
+ "");
+
DefParam("readonly",
"Are the hook files readonly. (This value gets changed on the fly,
so it is ok to leave the way it is.)",
diff --git a/mozilla/webtools/bonsai/globals.pl b/mozilla/webtools/bonsai/globals.pl
index 7a711487eb0..c800c0ae6a8 100644
--- a/mozilla/webtools/bonsai/globals.pl
+++ b/mozilla/webtools/bonsai/globals.pl
@@ -109,11 +109,18 @@ sub ConnectToDatabase {
my ($dsn);
if (!defined $::readdb) {
- $dsn = Param('shadowdbiparam') || Param('dbiparam');
+ my $dsn = Param('dbiparam');
+ my $dbuser = Param('mysqluser');
+ my $dbpass = Param('mysqlpassword');
+ if (Param('shadowdbiparam')) {
+ $dsn = Param('shadowdbiparam');
+ $dbuser = Param('shadowmysqluser');
+ $dbpass = Param('shadowmysqlpassword');
+ }
# DBI->trace(1, "/tmp/dbi.out");
- $::readdb = DBI->connect($dsn, Param('mysqluser'), Param('mysqlpassword'))
+ $::readdb = DBI->connect($dsn, $dbuser, $dbpass)
|| die "Can't connect to database server.";
$::db = $::readdb;
}