]> git.donarmstrong.com Git - debbugs.git/commitdiff
connect to and use the schema if it exists
authorDon Armstrong <don@donarmstrong.com>
Tue, 13 Mar 2018 00:08:01 +0000 (17:08 -0700)
committerDon Armstrong <don@donarmstrong.com>
Tue, 13 Mar 2018 00:08:20 +0000 (17:08 -0700)
cgi/bugreport.cgi
cgi/pkgreport.cgi

index 51744b2760a9d8b5e7038f6edbe4a78e5c89799f..226258a1b26063fc48ed17d9ef5470289a3412c2 100755 (executable)
@@ -24,6 +24,7 @@ use Debbugs::CGI qw(:url :html :util :cache :usertags);
 use Debbugs::CGI::Bugreport qw(:all);
 use Debbugs::Common qw(buglog getmaintainers make_list bug_status);
 use Debbugs::Packages qw(getpkgsrc);
+use Debbugs::DB;
 use Debbugs::Status qw(splitpackages split_status_fields get_bug_status isstrongseverity);
 
 use Scalar::Util qw(looks_like_number);
@@ -32,6 +33,11 @@ use Debbugs::Text qw(:templates);
 use URI::Escape qw(uri_escape_utf8);
 use List::AllUtils qw(max);
 
+my $s;
+if (defined $config{database}) {
+    $s = Debbugs::DB->connect($config{database}) or
+        die "Unable to connect to database";
+}
 
 use CGI::Simple;
 my $q = new CGI::Simple;
@@ -188,6 +194,7 @@ my %status;
 if ($need_status) {
     %status = %{split_status_fields(get_bug_status(bug=>$ref,
                                                   bugusertags => \%bugusertags,
+                                                   defined $s?(schema => $s):(),
                                                  ))}
 }
 
index abf739dec4c544f55dcfebb88b3c99d8ad78f245..d27caa13dc39c58dd5dc0a7216d1086fd39c32a1 100755 (executable)
@@ -39,6 +39,14 @@ use Debbugs::CGI::Pkgreport qw(:all);
 
 use Debbugs::Text qw(:templates);
 
+use Debbugs::DB;
+
+my $s;
+if (defined $config{database}) {
+    $s = Debbugs::DB->connect($config{database}) or
+        die "Unable to connect to DB";
+}
+
 use CGI::Simple;
 my $q = new CGI::Simple;
 
@@ -379,6 +387,7 @@ my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title);
                  grep {$_ ne 'newest'}
                  keys %package_search_keys, 'archive'),
                 usertags => \%ut,
+                defined $s?(schema => $s):(),
                );
 
 # shove in bugs which affect this package if there is a package or a
@@ -392,6 +401,7 @@ if (not exists $param{affects} and not exists $param{noaffects} and
                          grep {$_ ne 'newest'}
                          keys %package_search_keys, 'archive'),
                         usertags => \%ut,
+                         defined $s?(schema => $s):(),
                        );
 }
 
@@ -436,6 +446,7 @@ my $result = pkg_htmlizebugs(bugs => \@bugs,
                             exclude => $exclude,
                             this => $this,
                             options => \%param,
+                             defined $s?(schema => $s):(),
                             (exists $param{dist})?(dist    => $param{dist}):(),
                            );