From fea1c6467adc3eeda04bcb18cfadfa2736cf56cd Mon Sep 17 00:00:00 2001 From: "justdave%bugzilla.org" Date: Sun, 4 Feb 2007 04:09:22 +0000 Subject: [PATCH] Bug 367836: Let the shadowdb connection have its own username and password r=bear git-svn-id: svn://10.0.0.236/trunk@219464 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bonsai/defparams.pl | 20 +++++++++++++++----- mozilla/webtools/bonsai/globals.pl | 11 +++++++++-- 2 files changed, 24 insertions(+), 7 deletions(-) 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; }