diff options
author | wclouser@mozilla.com <wclouser@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5> | 2009-01-13 18:27:55 (GMT) |
---|---|---|
committer | wclouser@mozilla.com <wclouser@mozilla.com@4eb1ac78-321c-0410-a911-ec516a8615a5> | 2009-01-13 18:27:55 (GMT) |
commit | 1438e9556076cfd2797b3f5e77a534ccce15568f (patch) | |
tree | 3e2d5ddad786a2def13b11493fd415d57b3f8a8a /bin/parse_logs | |
parent | e86074dabe3a3b8c4a320475adace0b666956724 (diff) |
Only count correct dates; fix bug 468570
git-svn-id: http://svn.mozilla.org/addons/trunk@21539 4eb1ac78-321c-0410-a911-ec516a8615a5
Diffstat (limited to 'bin/parse_logs')
-rw-r--r-- | bin/parse_logs/count_update_pings.class.php | 13 | ||||
-rw-r--r-- | bin/parse_logs/log_parser.class.php | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/bin/parse_logs/count_update_pings.class.php b/bin/parse_logs/count_update_pings.class.php index 84be36c..b9dd642 100644 --- a/bin/parse_logs/count_update_pings.class.php +++ b/bin/parse_logs/count_update_pings.class.php @@ -44,14 +44,16 @@ class Count_Update_Pings { var $db; var $guids = array(); // array of GUIDs and add-on ids var $counts = array(); // array of update ping counts - var $totalSkipped = array('unknown_guid' => 0, 'SJ' => 0, 'NL' => 0, 'CN' => 0); + var $totalSkipped = array('incorrect_date' => 0, 'unknown_guid' => 0, 'SJ' => 0, 'NL' => 0, 'CN' => 0); var $totalCounted = 0; + var $date; // Only count hits for this date (format: %Y-%m-%d) /** * Retain reference to database connection and cache GUIDs */ - function Count_Update_Pings(&$db) { + function Count_Update_Pings(&$db, $date) { $this->db =& $db; + $this->date = $date; $this->cacheGUIDs(); } @@ -82,6 +84,13 @@ class Count_Update_Pings { else { $addon_id = $this->guids[$details['addon']['guid']]; $date = date('Y-m-d', $details['unixtime']); + + // Bug 468570 + if ($date != $this->date) { + $this->totalSkipped['incorrect_date']++; + outputIfVerbose("[UpdatePingCounter] Skipping out of range date {$date} for add-on id {$addon_id}"); + return; + } if (empty($this->counts[$date])) $this->counts[$date] = array(); diff --git a/bin/parse_logs/log_parser.class.php b/bin/parse_logs/log_parser.class.php index 5ad5e36..f64a9e0 100644 --- a/bin/parse_logs/log_parser.class.php +++ b/bin/parse_logs/log_parser.class.php @@ -101,7 +101,7 @@ class Log_Parser { } $this->date = $date; - $this->counter =& new Count_Update_Pings($this->db); + $this->counter =& new Count_Update_Pings($this->db, $this->date); } } |