This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".
The branch, 6.0 has been updated
via 63101f22ff455e537d43f479356622ceb1217afc (commit)
via 3cd50a674693e1dce6fe57b8b601e285954018b1 (commit)
from 78e5d21a4dc0c55153745694c7434d9c4bbe9043 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=63101f22ff455e537d43f479356622ceb1217afc
commit 63101f22ff455e537d43f479356622ceb1217afc
Merge: 78e5d21 3cd50a6
Author: Franck Villaume <[email protected]>
Date: Sun Jan 17 10:36:33 2016 +0100
Merge branch 'Branch_5_3' into 6.0
diff --cc src/cronjobs/db/db_trove_maint.php
index 4207882,0000000..8c15c5d
mode 100755,000000..100755
--- a/src/cronjobs/db/db_trove_maint.php
+++ b/src/cronjobs/db/db_trove_maint.php
@@@ -1,163 -1,0 +1,162 @@@
+#! /usr/bin/php
+<?php
+/**
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2009, Roland Mas
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+require dirname(__FILE__).'/../../common/include/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+require $gfcommon.'include/cron_utils.php';
+
+$err='';
+
+/*
+
+ Rebuild the trove_agg table, which saves us
+ from doing really expensive queries in trove
+ each time of the trove map is viewed
+
+*/
+
+db_begin();
+
+db_query_params ('DELETE FROM trove_agg',
+ array());
+
+db_query_params ('INSERT INTO trove_agg
+(SELECT tgl.trove_cat_id, g.group_id, g.group_name, g.unix_group_name,
g.status, g.register_time, g.short_description,
project_weekly_metric.percentile, project_weekly_metric.ranking
+FROM groups g
+LEFT JOIN project_weekly_metric USING (group_id), trove_group_link tgl,
pfo_role_setting prs
+WHERE tgl.group_id=g.group_id
+AND g.type_id = 1
+AND g.status = $1
+AND g.group_id = prs.ref_id
+AND prs.section_name = $2
+AND prs.role_id = 1
+ORDER BY trove_cat_id ASC, ranking ASC)',
+ array('A',
+ 'project_read'));
+$err .= db_error();
+
+db_commit();
+
+/*
+
+Calculate the number of projects under each category
+
+Do this by first running an aggregate query in the database,
+then putting that into two associative arrays.
+
+Start at the top of the trove tree and recursively go down
+the tree, building a third associative array which contains
+the count of projects under each category
+
+Then iterate through that third array and insert the results into the
+database inside of a transaction
+
+*/
+
+$cat_counts=array();
+$parent_list=array();
+
+$res = db_query_params ('SELECT trove_cat.trove_cat_id,trove_cat.parent
+FROM trove_cat
+WHERE trove_cat.trove_cat_id!=0
+GROUP BY trove_cat.trove_cat_id,trove_cat.parent',
+ array());
+$rows=db_numrows($res);
+
+for ($i=0; $i<$rows; $i++) {
+
$parent_list[db_result($res,$i,'parent')][]=db_result($res,$i,'trove_cat_id');
+}
+
+$res = db_query_params ('SELECT
trove_cat.trove_cat_id,trove_cat.parent,count(groups.group_id) AS count
+ FROM trove_cat LEFT JOIN trove_group_link ON
+ trove_cat.trove_cat_id=trove_group_link.trove_cat_id
+ LEFT JOIN groups ON
+ groups.group_id=trove_group_link.group_id,
+ pfo_role_setting prs
+ WHERE (groups.status=$1 OR groups.status IS NULL)
+ AND (groups.type_id=1 OR groups.status IS NULL)
+ AND groups.group_id = prs.ref_id
+ AND prs.section_name = $2
+ AND prs.role_id = 1
+ GROUP BY trove_cat.trove_cat_id,trove_cat.parent',
+ array('A',
+ 'project_read'));
+
+$rows = db_numrows($res);
+
+for ($i=0; $i<$rows; $i++) {
+
$cat_counts[db_result($res,$i,'trove_cat_id')][0]=db_result($res,$i,'parent');
+
$cat_counts[db_result($res,$i,'trove_cat_id')][1]=db_result($res,$i,'count');
+}
+
+$sum_totals=array();
+
+function get_trove_sub_projects($cat_id) {
+ global $cat_counts,$sum_totals,$parent_list;
+
+ // Number of groups that were in this trove_cat
+ $count=isset($cat_counts[$cat_id][1]) ? $cat_counts[$cat_id][1] : 0;
+
+ //number of children of this trove_cat
+ $rows=count( @$parent_list[$cat_id] );
+
+ for ($i=0; $i<$rows; $i++) {
+ $count += get_trove_sub_projects( $parent_list[$cat_id][$i] );
+ }
+ $sum_totals["$cat_id"]=$count;
+ return $count;
+}
+
+//start the recursive function at the top of the trove tree
+$res2 = db_query_params ('SELECT trove_cat_id FROM trove_cat WHERE parent=0',
+ array());
+
+for ($i=0; $i< db_numrows($res2); $i++) {
+ get_trove_sub_projects( db_result($res2,$i,0) );
+}
+
+db_begin();
+db_query_params ('DELETE FROM trove_treesums',
+ array());
+$err .= db_error();
+
+//$err .= "<table>";
+while (list($k,$v) = each($sum_totals)) {
+ $res = db_query_params ('INSERT INTO trove_treesums
(trove_cat_id,subprojects)
+ VALUES ($1,$2)',
+ array($k,
+ $v));
+ if (!$res || db_affected_rows($res)!=1) {
+ $err .= db_error();
+ }
+// $err .= "<tr><td>$k</td><td>$v</td></tr>\n";
+
+}
+//$err .= "</table>";
+
+db_commit();
+
+if (db_error()) {
+ $err .= "Error: ".db_error();
+}
+
+cron_entry(5,$err);
-
-----------------------------------------------------------------------
Summary of changes:
src/cronjobs/db/db_trove_maint.php | 1 -
1 file changed, 1 deletion(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits