diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Template.pm | 2 | ||||
-rw-r--r-- | Bugzilla/Token.pm | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 94dcdb85d..efc2b5931 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -1042,8 +1042,6 @@ sub create { 'get_api_token' => sub { return '' unless Bugzilla->user->id; - # BMO - hack so we don't create tokens when pointing to the shadow_db - return '' if Bugzilla->is_shadow_db; my $cache = Bugzilla->request_cache; return $cache->{api_token} //= issue_api_token(); }, 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; } } |