From 68af4d3c22ce1cb25793af5fb9f422bbb6ebe80e Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Tue, 27 Apr 2010 12:01:24 -0700 Subject: Bug 561322: Make Bugzilla::DB::_connect and related functions take their parameters as a hashref, to improve the API and to avoid exposing the database password on error. r=mkanat, a=mkanat (module owner) --- Bugzilla/DB/Mysql.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Bugzilla/DB/Mysql.pm') diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 297cf5758..13069a78a 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -61,7 +61,9 @@ use constant MAX_COMMENTS => 50; use base qw(Bugzilla::DB); sub new { - my ($class, $user, $pass, $host, $dbname, $port, $sock) = @_; + my ($class, $params) = @_; + my ($user, $pass, $host, $dbname, $port, $sock) = + @$params{qw(db_user db_pass db_host db_name db_port db_sock)}; # construct the DSN from the parameters we got my $dsn = "dbi:mysql:host=$host;database=$dbname"; @@ -74,7 +76,8 @@ sub new { mysql_auto_reconnect => 1, ); - my $self = $class->db_new($dsn, $user, $pass, \%attrs); + my $self = $class->db_new({ dsn => $dsn, user => $user, + pass => $pass, attrs => \%attrs }); # This makes sure that if the tables are encoded as UTF-8, we # return their data correctly. -- cgit v1.2.1