summaryrefslogtreecommitdiffstats
path: root/collectstats.pl
diff options
context:
space:
mode:
authorgerv%gerv.net <>2004-02-12 08:41:36 +0100
committergerv%gerv.net <>2004-02-12 08:41:36 +0100
commit9d6d4973520e1b05e1699e7a8f63e9ca2e773b77 (patch)
treec86a8711b2ed9cbf9766f2ee4e457f7cebc8ad28 /collectstats.pl
parent8c096c53c1f633f966e4ca831240b7b22ab40aca (diff)
downloadbugzilla-9d6d4973520e1b05e1699e7a8f63e9ca2e773b77.tar.gz
bugzilla-9d6d4973520e1b05e1699e7a8f63e9ca2e773b77.tar.xz
Bug 232897 - make collectstats.pl work with shadow databases, by reading from shadow and writing to master. Patch by gerv; r=bbaetz, a=justdave.
Diffstat (limited to 'collectstats.pl')
-rwxr-xr-xcollectstats.pl10
1 files changed, 9 insertions, 1 deletions
diff --git a/collectstats.pl b/collectstats.pl
index bc7b24884..e04169453 100755
--- a/collectstats.pl
+++ b/collectstats.pl
@@ -441,7 +441,13 @@ sub CollectSeriesData {
CleanupChartTables() if ($days_since_epoch % 7 == 0);
+ # We save a copy of the main $dbh and then switch to the shadow and get
+ # that one too. Remember, these may be the same.
+ Bugzilla->switch_to_main_db();
my $dbh = Bugzilla->dbh;
+ Bugzilla->switch_to_shadow_db();
+ my $shadow_dbh = Bugzilla->dbh;
+
my $serieses = $dbh->selectall_hashref("SELECT series_id, query, creator " .
"FROM series " .
"WHERE frequency != 0 AND " .
@@ -472,7 +478,7 @@ sub CollectSeriesData {
# We need to count the returned rows. Without subselects, we can't
# do this directly in the SQL for all queries. So we do it by hand.
- my $data = $dbh->selectall_arrayref($sql);
+ my $data = $shadow_dbh->selectall_arrayref($sql);
my $count = scalar(@$data) || 0;
@@ -482,6 +488,7 @@ sub CollectSeriesData {
}
sub CleanupChartTables {
+ Bugzilla->switch_to_main_db();
my $dbh = Bugzilla->dbh;
$dbh->do("LOCK TABLES series WRITE, user_series_map AS usm READ");
@@ -501,4 +508,5 @@ sub CleanupChartTables {
}
$dbh->do("UNLOCK TABLES");
+ Bugzilla->switch_to_shadow_db();
}