summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorbbaetz%acm.org <>2003-02-09 08:26:47 +0100
committerbbaetz%acm.org <>2003-02-09 08:26:47 +0100
commit731b5775ed45d22398a6c7969bd62922853c3b4e (patch)
treedcf66802734c54d1493e5ec9e498e1dc72ddfbf8 /Bugzilla.pm
parent3c5a0ebc7cbaa7817b759858a08e32ad32a64dc7 (diff)
downloadbugzilla-731b5775ed45d22398a6c7969bd62922853c3b4e.tar.gz
bugzilla-731b5775ed45d22398a6c7969bd62922853c3b4e.tar.xz
Bug 192393 - $::dbwritesallowed never set
r, a=justdave
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index a45c5ca0f..56d1f24cc 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -46,7 +46,6 @@ sub cgi {
my $_dbh;
my $_dbh_main;
my $_dbh_shadow;
-
sub dbh {
my $class = shift;
@@ -58,6 +57,17 @@ sub dbh {
return $_dbh;
}
+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;
@@ -175,6 +185,12 @@ method for those scripts/templates which are only use via CGI, though.
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.