summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2011-02-14 21:00:17 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-02-14 21:00:17 +0100
commita4ae80a43078cb33f759863c6f436619290137c3 (patch)
treebb2f7b5feb5abb562711a5e3e1bae88202607681 /Bugzilla/DB.pm
parenta995ad3f644961f57afc9d7bbdbd1b3849cdc74c (diff)
downloadbugzilla-a4ae80a43078cb33f759863c6f436619290137c3.tar.gz
bugzilla-a4ae80a43078cb33f759863c6f436619290137c3.tar.xz
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.pm')
-rw-r--r--Bugzilla/DB.pm53
1 files changed, 33 insertions, 20 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 0a3123ee9..095063f02 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -162,26 +162,41 @@ sub bz_check_requirements {
my $lc = Bugzilla->localconfig;
my $db = DB_MODULE->{lc($lc->{db_driver})};
+
# Only certain values are allowed for $db_driver.
if (!defined $db) {
die "$lc->{db_driver} is not a valid choice for \$db_driver in"
. bz_locations()->{'localconfig'};
}
- die("It is not safe to run Bugzilla inside the 'mysql' database.\n"
- . "Please pick a different value for \$db_name in localconfig.")
- if $lc->{db_name} eq 'mysql';
-
# Check the existence and version of the DBD that we need.
- my $dbd = $db->{dbd};
- my $sql_server = $db->{name};
- my $sql_want = $db->{db_version};
+ my $dbd = $db->{dbd};
+ _bz_check_dbd($db, $output);
+
+ # We don't try to connect to the actual database if $db_check is
+ # disabled.
+ unless ($lc->{db_check}) {
+ print "\n" if $output;
+ return;
+ }
+
+ # And now check the version of the database server itself.
+ my $dbh = _get_no_db_connection();
+ $dbh->bz_check_server_version($db, $output);
+
+ print "\n" if $output;
+}
+
+sub _bz_check_dbd {
+ my ($db, $output) = @_;
+
+ my $dbd = $db->{dbd};
unless (have_vers($dbd, $output)) {
+ my $sql_server = $db->{name};
my $command = install_command($dbd);
my $root = ROOT_USER;
my $dbd_mod = $dbd->{module};
my $dbd_ver = $dbd->{version};
- my $version = $dbd_ver ? " $dbd_ver or higher" : '';
die <<EOT;
For $sql_server, Bugzilla requires that perl's $dbd_mod $dbd_ver or later be
@@ -191,21 +206,18 @@ installed. To install this module, run the following command (as $root):
EOT
}
+}
- # We don't try to connect to the actual database if $db_check is
- # disabled.
- unless ($lc->{db_check}) {
- print "\n" if $output;
- return;
- }
-
- # And now check the version of the database server itself.
- my $dbh = _get_no_db_connection();
+sub bz_check_server_version {
+ my ($self, $db, $output) = @_;
- my $sql_vers = $dbh->bz_server_version;
- $dbh->disconnect;
+ my $sql_vers = $self->bz_server_version;
+ $self->disconnect;
+ my $sql_want = $db->{db_version};
my $version_ok = vers_cmp($sql_vers, $sql_want) > -1 ? 1 : 0;
+
+ my $sql_server = $db->{name};
if ($output) {
Bugzilla::Install::Requirements::_checking_for({
package => $sql_server, wanted => $sql_want,
@@ -224,7 +236,8 @@ newer version.
EOT
}
- print "\n" if $output;
+ # This is used by subclasses.
+ return $sql_vers;
}
# Note that this function requires that localconfig exist and