aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2009-11-22 22:24:07 +0000
committerlpsolit%gmail.com <>2009-11-22 22:24:07 +0000
commit86a245f0ab0d6f331f7bc911e62994a105e78693 (patch)
tree23dae272419ab9e61b66bb19c32a29165d0950fc /Bugzilla.pm
parentBump version number post-release. (diff)
downloadbugzilla-86a245f0ab0d6f331f7bc911e62994a105e78693.tar.gz
bugzilla-86a245f0ab0d6f331f7bc911e62994a105e78693.tar.bz2
bugzilla-86a245f0ab0d6f331f7bc911e62994a105e78693.zip
Bug 530270: Whining fails if mail queueing is enabled - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=LpSolit
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm22
1 files changed, 14 insertions, 8 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 3c547b980..b85186e6e 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -386,12 +386,17 @@ sub job_queue {
sub dbh {
my $class = shift;
# If we're not connected, then we must want the main db
- $class->request_cache->{dbh} ||= $class->request_cache->{dbh_main}
- = Bugzilla::DB::connect_main();
+ $class->request_cache->{dbh} ||= $class->dbh_main;
return $class->request_cache->{dbh};
}
+sub dbh_main {
+ my $class = shift;
+ $class->request_cache->{dbh_main} ||= Bugzilla::DB::connect_main();
+ return $class->request_cache->{dbh_main};
+}
+
sub languages {
my $class = shift;
return $class->request_cache->{languages}
@@ -487,7 +492,7 @@ sub switch_to_shadow_db {
if ($class->params->{'shadowdb'}) {
$class->request_cache->{dbh_shadow} = Bugzilla::DB::connect_shadow();
} else {
- $class->request_cache->{dbh_shadow} = request_cache()->{dbh_main};
+ $class->request_cache->{dbh_shadow} = $class->dbh_main;
}
}
@@ -501,11 +506,8 @@ sub switch_to_shadow_db {
sub switch_to_main_db {
my $class = shift;
- $class->request_cache->{dbh} = $class->request_cache->{dbh_main};
- # We have to return $class->dbh instead of {dbh} as
- # {dbh_main} may be undefined if no connection to the main DB
- # has been established yet.
- return $class->dbh;
+ $class->request_cache->{dbh} = $class->dbh_main;
+ return $class->dbh_main;
}
sub get_fields {
@@ -796,6 +798,10 @@ used to automatically answer or skip prompts.
The current database handle. See L<DBI>.
+=item C<dbh_main>
+
+The main database handle. See L<DBI>.
+
=item C<languages>
Currently installed languages.