summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-11-14 02:50:47 +0100
committerlpsolit%gmail.com <>2005-11-14 02:50:47 +0100
commit03352ccf9bdb6b816e0650f8f76e008a17df87c0 (patch)
tree8a641b8c42abdd70b94bb3a9c87fe9a0788cb6be /Bugzilla.pm
parente4fa51953ec018c733040ccf9a478b2e8aac0bac (diff)
downloadbugzilla-03352ccf9bdb6b816e0650f8f76e008a17df87c0.tar.gz
bugzilla-03352ccf9bdb6b816e0650f8f76e008a17df87c0.tar.xz
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.pm25
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.