diff options
Diffstat (limited to 'site/app/controllers/components/stats.php')
-rw-r--r-- | site/app/controllers/components/stats.php | 88 |
1 files changed, 1 insertions, 87 deletions
diff --git a/site/app/controllers/components/stats.php b/site/app/controllers/components/stats.php index 3702a3c..21dded6 100644 --- a/site/app/controllers/components/stats.php +++ b/site/app/controllers/components/stats.php @@ -125,10 +125,8 @@ class StatsComponent extends Object { // Update pings per day case 'updatepings': - // Since summing update pings per day isn't as useful as summing - // the other data points, we're taking an average here instead. if ($data = $model->query(" - SELECT `date`, {$date_group_column} AVG(`count`) as `count` + SELECT `date`, {$date_group_column} sum(`count`) as `count` FROM `update_counts` WHERE `addon_id`={$addon_id} AND date != '0000-00-00' GROUP BY `{$date_group_by}` @@ -523,89 +521,5 @@ class StatsComponent extends Object { return $xml; } - - /** - * @return array Array of count results for the current day. - */ - function getDailyStats() { - - $yesterday = date('Y-m-d', strtotime('yesterday')); - $after = $yesterday.' 00:00:00'; - $before = $yesterday.' 23:59:59'; - - $ret = array( - 'nomination' => '', - 'pending' => '', - 'flagged' => '', - 'reviews' => '', - 'dailyAddons' => '', - 'totalAddons' => '', - 'dailyVersions' => '', - 'dailyUsers' => '', - 'dailyImages' => '', - 'dailyDownloads' => '', - 'after' => $after, - 'before' => $before - ); - - $model =& $this->controller->Addon; - - if ($buf = $model->query("SELECT COUNT(*) as nomination FROM addons WHERE status=3", true)) { - $ret['nomination'] = $buf[0][0]['nomination']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as pending FROM files WHERE status=2", true)) { - $ret['pending'] = $buf[0][0]['pending']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as flagged FROM addons WHERE adminreview=1", true)) { - $ret['flagged'] = $buf[0][0]['flagged']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as reviews FROM reviews WHERE editorreview=1", true)) { - $ret['reviews'] = $buf[0][0]['reviews']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as total FROM addons WHERE created >= '{$after}' AND created <= '{$before}'", true)) { - $ret['dailyAddons'] = $buf[0][0]['total']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as total FROM addons", true)) { - $ret['totalAddons'] = $buf[0][0]['total']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as total FROM versions WHERE created >= '{$after}' AND created <= '{$before}'", true)) { - $ret['dailyVersions'] = $buf[0][0]['total']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as total FROM users WHERE created >= '{$after}' AND created <= '{$before}'", true)) { - $ret['dailyUsers'] = $buf[0][0]['total']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as total FROM reviews WHERE created >= '{$after}' AND created <= '{$before}'", true)) { - $ret['dailyReviews'] = $buf[0][0]['total']; - unset($buf); - } - - if ($buf = $model->query("SELECT COUNT(*) as total FROM previews WHERE created >= '{$after}' AND created <= '{$before}'", true)) { - $ret['dailyImages'] = $buf[0][0]['total']; - unset($buf); - } - - if ($buf = $model->query("SELECT SUM(count) as count FROM download_counts WHERE date = '{$yesterday}'", true)) { - $ret['dailyDownloads'] = $buf[0][0]['count']; - unset($buf); - } - - return $ret; - } } ?> |