5 * Portions Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright (c) GForge, LLC
8 * This file is part of GForge.
10 * GForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * GForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with GForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
25 require dirname(__FILE__).'/../www/env.inc.php';
26 require $gfwww.'include/squal_pre.php';
27 require $gfcommon.'include/cron_utils.php';
37 // project stats by month
40 $err .= "\n\nBeginning stats_project_months: ".date('Y-m-d H:i:s',time());
42 $res = db_query_params ('DELETE FROM stats_project_months',
46 $res = db_query_params ('INSERT INTO stats_project_months
47 SELECT month, group_id,
48 avg(developers)::int AS developers, avg(group_ranking)::int AS group_ranking,
49 avg(group_metric) AS group_metric,
50 sum(logo_showings) AS logo_showings,
51 sum(downloads) AS downloads,
52 sum(site_views) AS site_views ,
53 sum(subdomain_views) AS subdomain_views,
54 sum(page_views) AS page_views,
55 sum(file_releases) AS file_releases,
56 sum(msg_posted) AS msg_posted,
57 sum(msg_uniq_auth) AS msg_uniq_auth,
58 sum(bugs_opened) AS bugs_opened,
59 sum(bugs_closed) AS bugs_closed,
60 sum(support_opened) AS support_opened,
61 sum(support_closed) AS support_closed,
62 sum(patches_opened) AS patches_opened,
63 sum(patches_closed) AS patches_closed,
64 sum(artifacts_opened) AS artifacts_opened,
65 sum(artifacts_closed) AS artifacts_closed,
66 sum(tasks_opened) AS tasks_opened,
67 sum(tasks_closed) AS tasks_closed,
68 sum(help_requests) AS help_requests,
69 sum(cvs_checkouts) AS cvs_checkouts,
70 sum(cvs_commits) AS cvs_commits,
71 sum(cvs_adds) AS cvs_adds
73 GROUP BY month,group_id',
80 // main site page views by month
84 $err .= "\n\nBeginning stats_site_pages_by_month: ".date('Y-m-d H:i:s',time());
86 $res = db_query_params ('DELETE FROM stats_site_pages_by_month',
90 $res = db_query_params ('INSERT INTO stats_site_pages_by_month
91 select month,sum(site_page_views) as site_page_views
92 from stats_site_pages_by_day group by month',
96 $err .= "ERROR IN stats_site_pages_by_month";
104 // sitewide stats in last 30 days
108 $err .= "\n\nBeginning stats_site_months: ".date('Y-m-d H:i:s',time());
110 $res = db_query_params ('DELETE FROM stats_site_months',
114 $res = db_query_params ('INSERT INTO stats_site_months
116 sspbm.site_page_views,
117 SUM(spm.downloads) AS downloads,
118 SUM(spm.subdomain_views) AS subdomain_views,
119 SUM(spm.msg_posted) AS msg_posted,
120 SUM(spm.bugs_opened) AS bugs_opened,
121 SUM(spm.bugs_closed) AS bugs_closed,
122 SUM(spm.support_opened) AS support_opened,
123 SUM(spm.support_closed) AS support_closed,
124 SUM(spm.patches_opened) AS patches_opened,
125 SUM(spm.patches_closed) AS patches_closed,
126 SUM(spm.artifacts_opened) AS artifacts_opened,
127 SUM(spm.artifacts_closed) AS artifacts_closed,
128 SUM(spm.tasks_opened) AS tasks_opened,
129 SUM(spm.tasks_closed) AS tasks_closed,
130 SUM(spm.help_requests) AS help_requests,
131 SUM(spm.cvs_checkouts) AS cvs_checkouts,
132 SUM(spm.cvs_commits) AS cvs_commits,
133 SUM(spm.cvs_adds) AS cvs_adds
134 FROM stats_project_months spm, stats_site_pages_by_month sspbm
135 WHERE spm.month=sspbm.month
136 GROUP BY spm.month,sspbm.site_page_views
137 ORDER BY spm.month ASC;