diff options
author | lpsolit%gmail.com <> | 2005-11-14 01:50:47 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-11-14 01:50:47 +0000 |
commit | 03352ccf9bdb6b816e0650f8f76e008a17df87c0 (patch) | |
tree | 8a641b8c42abdd70b94bb3a9c87fe9a0788cb6be /Bugzilla.pm | |
parent | Bug 301062: [PostgreSQL] whine.pl fails when using PostgreSQL 8.0.x - Patch b... (diff) | |
download | bugzilla-03352ccf9bdb6b816e0650f8f76e008a17df87c0.tar.gz bugzilla-03352ccf9bdb6b816e0650f8f76e008a17df87c0.tar.bz2 bugzilla-03352ccf9bdb6b816e0650f8f76e008a17df87c0.zip |
Bug 313695: buglist.cgi and some other scripts do not use the shadow DB anymore - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=justdave
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r-- | Bugzilla.pm | 25 |
1 files changed, 8 insertions, 17 deletions
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<DBI>. -=item C<dbwritesallowed> - -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_to_shadow_db> Switch from using the main database to using the shadow database. |