From 03352ccf9bdb6b816e0650f8f76e008a17df87c0 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 14 Nov 2005 01:50:47 +0000 Subject: Bug 313695: buglist.cgi and some other scripts do not use the shadow DB anymore - Patch by Frédéric Buclin r/a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla.pm | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index de30d8c99..501290992 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -242,17 +242,6 @@ sub batch { return $_batch || 0; } -sub dbwritesallowed { - my $class = shift; - - # We can write if we are connected to the main database. - # Note that if we don't have a shadowdb, then we claim that its ok - # to write even if we're nominally connected to the shadowdb. - # This is OK because this method is only used to test if misc - # updates can be done, rather than anything complicated. - return $class->dbh == $_dbh_main; -} - sub switch_to_shadow_db { my $class = shift; @@ -265,12 +254,20 @@ sub switch_to_shadow_db { } $_dbh = $_dbh_shadow; + # we have to return $class->dbh instead of $_dbh as + # $_dbh_shadow may be undefined if no shadow DB is used + # and no connection to the main DB has been established yet. + return $class->dbh; } sub switch_to_main_db { my $class = shift; $_dbh = $_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; } # Private methods @@ -440,12 +437,6 @@ Bugzilla->batch will return the current state of this flag. The current database handle. See L. -=item C - -Determines if writes to the database are permitted. This is usually used to -determine if some general cleanup needs to occur (such as clearing the token -table) - =item C Switch from using the main database to using the shadow database. -- cgit v1.2.3-24-g4f1b