[Fusionforge-commits] r8399 - trunk/gforge/cronjobs

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Nov 18 21:23:24 CET 2009


Author: lolando
Date: 2009-11-18 21:23:24 +0100 (Wed, 18 Nov 2009)
New Revision: 8399

Modified:
   trunk/gforge/cronjobs/db_stats_agg.php
Log:
db_query_params() transition

Modified: trunk/gforge/cronjobs/db_stats_agg.php
===================================================================
--- trunk/gforge/cronjobs/db_stats_agg.php	2009-11-18 20:23:13 UTC (rev 8398)
+++ trunk/gforge/cronjobs/db_stats_agg.php	2009-11-18 20:23:24 UTC (rev 8399)
@@ -39,18 +39,14 @@
 db_begin();
 $err .= "\n\nBeginning stats_project_months: ".date('Y-m-d H:i:s',time());
 
-$rel = db_query_params ('DELETE FROM stats_project_months',
+$res = db_query_params ('DELETE FROM stats_project_months',
 			array ());
 $err .= db_error();
 
-$sql="INSERT INTO stats_project_months
-	SELECT month, group_id, ";
 if ($sys_database_type == 'mysql') {
-	$sql.="avg(developers) AS developers, avg(group_ranking) AS group_ranking, ";
-} else {
-	$sql.="avg(developers)::int AS developers, avg(group_ranking)::int AS group_ranking, ";
-}
-$sql.="
+	$sql="INSERT INTO stats_project_months
+	SELECT month, group_id, 
+	avg(developers) AS developers, avg(group_ranking) AS group_ranking, 
 	avg(group_metric) AS group_metric,
 	sum(logo_showings) AS logo_showings,
 	sum(downloads) AS downloads,
@@ -77,7 +73,38 @@
 FROM stats_project_vw
 GROUP BY month,group_id
 ";
-$rel=db_query($sql);
+	$res = db_query_mysql ($sql);
+} else {
+	$res = db_query_params ('INSERT INTO stats_project_months
+	SELECT month, group_id,
+	avg(developers)::int AS developers, avg(group_ranking)::int AS group_ranking, 
+	avg(group_metric) AS group_metric,
+	sum(logo_showings) AS logo_showings,
+	sum(downloads) AS downloads,
+	sum(site_views) AS site_views ,
+	sum(subdomain_views) AS subdomain_views,
+	sum(page_views) AS page_views,
+	sum(file_releases) AS file_releases,
+	sum(msg_posted) AS msg_posted,
+	sum(msg_uniq_auth) AS msg_uniq_auth,
+	sum(bugs_opened) AS bugs_opened,
+	sum(bugs_closed) AS bugs_closed,
+	sum(support_opened) AS support_opened,
+	sum(support_closed) AS support_closed,
+	sum(patches_opened) AS patches_opened,
+	sum(patches_closed) AS patches_closed,
+	sum(artifacts_opened) AS artifacts_opened,
+	sum(artifacts_closed) AS artifacts_closed,
+	sum(tasks_opened) AS tasks_opened,
+	sum(tasks_closed) AS tasks_closed,
+	sum(help_requests) AS help_requests,
+	sum(cvs_checkouts) AS cvs_checkouts,
+	sum(cvs_commits) AS cvs_commits,
+	sum(cvs_adds) AS cvs_adds
+FROM stats_project_vw
+GROUP BY month,group_id',
+			 array ()) ;
+}
 $err .= db_error();
 
 db_commit();
@@ -89,16 +116,16 @@
 
 $err .= "\n\nBeginning stats_site_pages_by_month: ".date('Y-m-d H:i:s',time());
 
-$rel = db_query_params ('DELETE FROM stats_site_pages_by_month',
+$res = db_query_params ('DELETE FROM stats_site_pages_by_month',
 			array ());
 $err .= db_error();
 
-$rel = db_query_params ('INSERT INTO stats_site_pages_by_month
+$res = db_query_params ('INSERT INTO stats_site_pages_by_month
 select month,sum(site_page_views) as site_page_views
     from stats_site_pages_by_day group by month',
 			array ());
 
-if (!$rel) {
+if (!$res) {
 	$err .= "ERROR IN stats_site_pages_by_month";
 }
 
@@ -113,11 +140,11 @@
 
 $err .= "\n\nBeginning stats_site_months: ".date('Y-m-d H:i:s',time());
 
-$rel = db_query_params ('DELETE FROM stats_site_months',
+$res = db_query_params ('DELETE FROM stats_site_months',
 			array ());
 $err .= db_error();
 
-$rel = db_query_params ('INSERT INTO stats_site_months
+$res = db_query_params ('INSERT INTO stats_site_months
 SELECT spm.month,
 	sspbm.site_page_views,
 	SUM(spm.downloads) AS downloads,




More information about the Fusionforge-commits mailing list