display_data();
}
+# Get data from the shadow DB as they don't change very often.
+Bugzilla->switch_to_shadow_db;
+
# Pass a bunch of Bugzilla configuration to the templates.
my $vars = {};
$vars->{'priority'} = get_legal_field_values('priority');
use Bugzilla::Product;
my $user = Bugzilla->login();
-
my $cgi = Bugzilla->cgi;
-my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
print $cgi->header();
+# This script does nothing but displaying mostly static data.
+Bugzilla->switch_to_shadow_db;
+
my $product_name = trim($cgi->param('product') || '');
my $product = new Bugzilla::Product({'name' => $product_name});
my $template = Bugzilla->template;
my $vars = {};
+# Run queries against the shadow DB.
+Bugzilla->switch_to_shadow_db;
+
$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count();
$vars->{'caneditkeywords'} = Bugzilla->user->in_group("editkeywords");
$buffer = "";
}
+# We are done with changes committed to the DB.
+$dbh = Bugzilla->switch_to_shadow_db;
+
my $userdefaultquery;
if ($userid) {
$userdefaultquery = $dbh->selectrow_array(
# Make sure the user is logged in.
my $user = Bugzilla->login();
my $cgi = Bugzilla->cgi;
+# Force the script to run against the shadow DB. We already validated credentials.
+Bugzilla->switch_to_shadow_db;
my $template = Bugzilla->template;
my $action = $cgi->param('action') || '';
sub queue {
my $cgi = Bugzilla->cgi;
- # There are some user privilege checks to do. We do them against the main DB.
my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $user = Bugzilla->user;
$query .= " AND flags.status = '?' " unless $status;
# The set of criteria by which we filter records to display in the queue.
- # We now move to the shadow DB to query the DB.
my @criteria = ();
- $dbh = Bugzilla->switch_to_shadow_db;
# A list of columns to exclude from the report because the report conditions
# limit the data being displayed to exact matches for those columns.
my $flagtypes = get_flag_types();
push(@types, @$flagtypes);
- # We move back to the main DB to get the list of products the user can see.
- $dbh = Bugzilla->switch_to_main_db;
-
$vars->{'products'} = $user->get_selectable_products;
$vars->{'excluded_columns'} = \@excluded_columns;
$vars->{'group_field'} = $form_group;
# End Data/Security Validation
###############################################################################
+# Run queries against the shadow DB. In the worst case, new changes are not
+# visible immediately due to replication lag.
+Bugzilla->switch_to_shadow_db;
+
($vars->{'operations'}, $vars->{'incomplete_data'}) =
Bugzilla::Bug::GetBugActivity($bug->id);
my @bugs = ();
my %marks;
+# If the user isn't logged in, we use data from the shadow DB. If he plans
+# to edit the bug(s), he will have to log in first, meaning that the data
+# will be reloaded anyway, from the main DB.
+Bugzilla->switch_to_shadow_db unless $user->id;
+
if ($single) {
my $id = $cgi->param('id');
push @bugs, Bugzilla::Bug->check($id);