From fdffad3b44892e2049aa2bc2588bf4ee991360ef Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Mon, 12 Mar 2018 17:08:01 -0700 Subject: [PATCH] connect to and use the schema if it exists --- cgi/bugreport.cgi | 7 +++++++ cgi/pkgreport.cgi | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 51744b2..226258a 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -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):(), ))} } diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index abf739d..d27caa1 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -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}):(), ); -- 2.39.2