5 * Portions Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright (c) GForge, LLC
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require dirname(__FILE__).'/../www/env.inc.php';
25 require_once $gfcommon.'include/pre.php';
26 require $gfcommon.'include/cron_utils.php';
36 // project stats by month
39 $err .= "\n\nBeginning stats_project_months: ".date('Y-m-d H:i:s',time());
41 $res = db_query_params ('DELETE FROM stats_project_months',
45 $res = db_query_params ('INSERT INTO stats_project_months
46 SELECT month, group_id,
47 avg(developers)::int AS developers,
48 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;