summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Token.pm
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-03-10 06:13:49 +0100
committerByron Jones <glob@mozilla.com>2015-03-10 06:13:49 +0100
commit887524670413292b71448bd0c67ab2b786c78b49 (patch)
tree794e276bdc45f081b681357069d61e8aa05be464 /Bugzilla/Token.pm
parentef96ae157223b3309f7703798b32b0b386b2edff (diff)
downloadbugzilla-887524670413292b71448bd0c67ab2b786c78b49.tar.gz
bugzilla-887524670413292b71448bd0c67ab2b786c78b49.tar.xz
Bug 1139749: backport bug 1128853 to bmo (Bugzilla shouldn't try to write API tokens into the shadow DB)
Diffstat (limited to 'Bugzilla/Token.pm')
-rw-r--r--Bugzilla/Token.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm
index 769cb8800..750c36435 100644
--- a/Bugzilla/Token.pm
+++ b/Bugzilla/Token.pm
@@ -450,6 +450,9 @@ sub _create_token {
trick_taint($tokentype);
trick_taint($eventdata);
+ my $is_shadow = Bugzilla->is_shadow_db;
+ $dbh = Bugzilla->switch_to_main_db() if $is_shadow;
+
$dbh->bz_start_transaction();
my $token = GenerateUniqueToken();
@@ -462,8 +465,10 @@ sub _create_token {
if (wantarray) {
my (undef, $token_ts, undef) = GetTokenData($token);
$token_ts = str2time($token_ts);
+ Bugzilla->switch_to_shadow_db() if $is_shadow;
return ($token, $token_ts);
} else {
+ Bugzilla->switch_to_shadow_db() if $is_shadow;
return $token;
}
}