diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2011-02-14 12:00:17 -0800 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2011-02-14 12:00:17 -0800 |
commit | a4ae80a43078cb33f759863c6f436619290137c3 (patch) | |
tree | bb2f7b5feb5abb562711a5e3e1bae88202607681 /Bugzilla/DB | |
parent | Bug 581422: Improve the readability of the text at the top of the attachment (diff) | |
download | bugzilla-a4ae80a43078cb33f759863c6f436619290137c3.tar.gz bugzilla-a4ae80a43078cb33f759863c6f436619290137c3.tar.bz2 bugzilla-a4ae80a43078cb33f759863c6f436619290137c3.zip |
Bug 603127: Make checksetup.pl require DBD::Pg 2.17.2 when using Pg 9.0 or
later.
r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 12 | ||||
-rw-r--r-- | Bugzilla/DB/Pg.pm | 13 |
2 files changed, 25 insertions, 0 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index b9143d7b6..06bf3d8df 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -287,6 +287,18 @@ sub _bz_get_initial_schema { # Database Setup ##################################################################### +sub bz_check_server_version { + my $self = shift; + + my $lc = Bugzilla->localconfig; + if (lc(Bugzilla->localconfig->{db_name}) eq 'mysql') { + die "It is not safe to run Bugzilla inside a database named 'mysql'.\n" + . " Please pick a different value for \$db_name in localconfig.\n"; + } + + $self->SUPER::bz_check_server_version(@_); +} + sub bz_setup_database { my ($self) = @_; diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index 7802d58ef..e59a638a4 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -211,6 +211,19 @@ sub bz_explain { # Custom Database Setup ##################################################################### +sub bz_check_server_version { + my $self = shift; + my ($db) = @_; + my $server_version = $self->SUPER::bz_check_server_version(@_); + my ($major_version) = $server_version =~ /^(\d+)/; + # Pg 9 requires DBD::Pg 2.17.2 in order to properly read bytea values. + if ($major_version >= 9) { + local $db->{dbd}->{version} = '2.17.2'; + local $db->{name} = $db->{name} . ' 9+'; + Bugzilla::DB::_bz_check_dbd(@_); + } +} + sub bz_setup_database { my $self = shift; $self->SUPER::bz_setup_database(@_); |