[Fusionforge-commits] FusionForge branch master updated. 04f8b9ad805277d48834db5618afeca9a1aa7c7b

Sylvain Beucler beuc-inria at fusionforge.org
Fri Sep 12 17:23:48 CEST 2014


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, master has been updated
       via  04f8b9ad805277d48834db5618afeca9a1aa7c7b (commit)
       via  9f4f885d9948336fbd7c5d08ca2f66a7d984a113 (commit)
       via  881e816eb53f5a1e6af2b0d0b1d688b763526d18 (commit)
       via  1cc7fd879bd9f978181b77f64aa252a2d45a4371 (commit)
      from  4ccc335d9fad94a0b066b0dd16f73b543ef709d9 (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 -----------------------------------------------------------------
commit 04f8b9ad805277d48834db5618afeca9a1aa7c7b
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Fri Sep 12 17:22:12 2014 +0200

    front-page stats: allow displaying the real number of projects; use consistent counting in /softwaremap/full_list.php

diff --git a/src/common/include/FusionForge.class.php b/src/common/include/FusionForge.class.php
index 31147bb..e008577 100644
--- a/src/common/include/FusionForge.class.php
+++ b/src/common/include/FusionForge.class.php
@@ -62,29 +62,9 @@ class FusionForge extends Error {
 	}
 
 	/**
-	 * List full number of hosted projects that anonymous users can see
+	 * List full number of hosted projects, public and private
 	 */
-	function getNumberOfPublicHostedProjects() {
-		$res = db_query_params ('SELECT group_id FROM groups WHERE status=$1',
-				      array ('A'));
-		if (!$res) {
-			$this->setError('Unable to get hosted project count: '.db_error());
-			return false;
-		}
-		$count = 0;
-		$ra = RoleAnonymous::getInstance() ;
-		while ($row = db_fetch_array($res)) {
-			if ($ra->hasPermission('project_read', $row['group_id'])) {
-				$count++;
-			}
-		}
-		return $count;
-	}
-
-	/**
-	 * List full number of hosted projects
-	 */
-	function getNumberOfHostedProjects() {
+	function getNumberOfActiveProjects() {
 		$res = db_query_params ('SELECT count(*) FROM groups WHERE status=$1',
 					array ('A'));
 		if (!$res) {
diff --git a/src/common/include/Group.class.php b/src/common/include/Group.class.php
index 5e054a8..54ec1de 100644
--- a/src/common/include/Group.class.php
+++ b/src/common/include/Group.class.php
@@ -163,7 +163,7 @@ function group_get_object_by_publicname($groupname) {
  * @param	int	$max_query_limit Optional Maximum number of rows to limit query length
  * @return	array	List of public active projects
  */
-function get_public_active_projects_asc($max_query_limit = -1) {
+function group_get_public_active_projects_asc($max_query_limit = -1) {
 
 	$res_grp = db_query_params ('
 			SELECT group_id, group_name, unix_group_name, short_description, register_time
diff --git a/src/etc/config.ini.d/defaults.ini b/src/etc/config.ini.d/defaults.ini
index ed5537f..cdc4049 100644
--- a/src/etc/config.ini.d/defaults.ini
+++ b/src/etc/config.ini.d/defaults.ini
@@ -81,6 +81,7 @@ use_tracker = yes
 use_trove = yes
 use_project_tags = yes
 use_project_full_list = yes
+sitestats_projects_count = visible
 allow_project_without_template = yes
 use_webdav = no
 user_default_shell = "/bin/bash"
diff --git a/src/plugins/admssw/include/admsswPlugin.class.php b/src/plugins/admssw/include/admsswPlugin.class.php
index 3fc86c6..95335fd 100644
--- a/src/plugins/admssw/include/admsswPlugin.class.php
+++ b/src/plugins/admssw/include/admsswPlugin.class.php
@@ -439,7 +439,7 @@ projects on /projects URLs with content-negociation
 	 */
 	public function getProjectListSize() {
 		// same as for trove's full list
- 		$projects = get_public_active_projects_asc();
+ 		$projects = group_get_public_active_projects_asc();
 		return count($projects);
 	}
 
@@ -475,7 +475,7 @@ projects on /projects URLs with content-negociation
 		$res->setProp('adms:supportedSchema', 'ADMS.SW v1.0');
 
 		// same as for trove's full list
-		$projects = get_public_active_projects_asc();
+		$projects = group_get_public_active_projects_asc();
 
 		if ( isset($chunk) && isset($chunksize) ) {
 			// TODO : do some checks on $chunk $chunksize values
diff --git a/src/www/include/features_boxes.php b/src/www/include/features_boxes.php
index 8028faf..b2ccbf6 100644
--- a/src/www/include/features_boxes.php
+++ b/src/www/include/features_boxes.php
@@ -138,14 +138,24 @@ function stats_downloads_total() {
 function show_sitestats() {
 	$fforge = new FusionForge();
 	$return = '<p>';
-	$return .= _('Public Hosted Projects')._(': ');
-	$content = '<strong>'.number_format($fforge->getNumberOfPublicHostedProjects()).'</strong>';
+
+	$count_type = forge_get_config('sitestats_projects_count');
+	if ($count_type == 'visible') {
+		$arr = group_get_public_active_projects_asc();  // cf. softwaremap/full_list.php
+		$count = count($arr);
+	} else { //if ($count_type == 'all') {
+		$count = $fforge->getNumberOfActiveProjects();
+	}
+	$return .= _('Hosted Projects')._(': ');
+	$content = '<strong>'.number_format($count).'</strong>';
+
 	if (forge_get_config('use_project_full_list')) {
 		$return .= util_make_link('/softwaremap/full_list.php', $content);
 	} else {
 		$return .= $content;
 	}
 	$return .= "</p><p>";
+
 	$return .= _('Registered Users')._(': ').'<strong>'.
 		number_format($fforge->getNumberOfActiveUsers()).'</strong>';
 	$return .= "</p>\n";
diff --git a/src/www/softwaremap/full_list.php b/src/www/softwaremap/full_list.php
index 7bac04e..ba6cb85 100644
--- a/src/www/softwaremap/full_list.php
+++ b/src/www/softwaremap/full_list.php
@@ -53,7 +53,7 @@ if (!forge_get_config('use_project_full_list')) {
 $HTML->header(array('title'=>_('Project List'),'pagename'=>'softwaremap'));
 $HTML->printSoftwareMapLinks();
 
-$projects = get_public_active_projects_asc($TROVE_HARDQUERYLIMIT);
+$projects = group_get_public_active_projects_asc($TROVE_HARDQUERYLIMIT);
 
 $querytotalcount = count($projects);
 

commit 9f4f885d9948336fbd7c5d08ca2f66a7d984a113
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Fri Sep 12 17:19:26 2014 +0200

    viewvc: add missing copyright notice

diff --git a/src/www/scm/viewvc.php b/src/www/scm/viewvc.php
index 78c9f11..bb5fb61 100644
--- a/src/www/scm/viewvc.php
+++ b/src/www/scm/viewvc.php
@@ -10,6 +10,7 @@
  *
  * Copyright 2010, Franck Villaume - Capgemini
  * Copyright 2012,2014, Franck Villaume - TrivialDev
+ * Copyright (C) 2014  Inria (Sylvain Beucler)
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;

commit 881e816eb53f5a1e6af2b0d0b1d688b763526d18
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Fri Sep 12 16:29:15 2014 +0200

    Fix (not used yet) getNumberOfHostedProjects to display the full number of projects

diff --git a/src/common/include/FusionForge.class.php b/src/common/include/FusionForge.class.php
index f6b2de5..31147bb 100644
--- a/src/common/include/FusionForge.class.php
+++ b/src/common/include/FusionForge.class.php
@@ -61,6 +61,9 @@ class FusionForge extends Error {
 		return true;
 	}
 
+	/**
+	 * List full number of hosted projects that anonymous users can see
+	 */
 	function getNumberOfPublicHostedProjects() {
 		$res = db_query_params ('SELECT group_id FROM groups WHERE status=$1',
 				      array ('A'));
@@ -78,21 +81,17 @@ class FusionForge extends Error {
 		return $count;
 	}
 
+	/**
+	 * List full number of hosted projects
+	 */
 	function getNumberOfHostedProjects() {
-		$res = db_query_params ('SELECT group_id FROM groups WHERE status=$1',
+		$res = db_query_params ('SELECT count(*) FROM groups WHERE status=$1',
 					array ('A'));
 		if (!$res) {
 			$this->setError('Unable to get hosted project count: '.db_error());
 			return false;
 		}
-		$count = 0;
-		$ra = RoleAnonymous::getInstance() ;
-		while ($row = db_fetch_array($res)) {
-			if ($ra->hasPermission('project_read', $row['group_id'])) {
-				$count++;
-			}
-		}
-		return $count;
+		return $this->parseCount($res);
 	}
 
 	function getNumberOfActiveUsers() {

commit 1cc7fd879bd9f978181b77f64aa252a2d45a4371
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Fri Sep 12 16:28:31 2014 +0200

    Remove unused functions

diff --git a/src/www/include/features_boxes.php b/src/www/include/features_boxes.php
index a75478d..8028faf 100644
--- a/src/www/include/features_boxes.php
+++ b/src/www/include/features_boxes.php
@@ -113,16 +113,6 @@ function show_top_downloads() {
 	return $return;
 }
 
-function stats_getprojects_active_public() {
-	$ff = new FusionForge();
-	return $ff->getNumberOfPublicHostedProjects();
-}
-
-function stats_getprojects_total() {
-	$ff = new FusionForge();
-	return $ff->getNumberOfHostedProjects();
-}
-
 function stats_getpageviews_total() {
 	$res_count = db_query_params ('SELECT SUM(site_views) AS site, SUM(subdomain_views) AS subdomain FROM stats_site',
 			array());

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/FusionForge.class.php          |   33 ++++-----------------
 src/common/include/Group.class.php                |    2 +-
 src/etc/config.ini.d/defaults.ini                 |    1 +
 src/plugins/admssw/include/admsswPlugin.class.php |    4 +--
 src/www/include/features_boxes.php                |   24 +++++++--------
 src/www/scm/viewvc.php                            |    1 +
 src/www/softwaremap/full_list.php                 |    2 +-
 7 files changed, 24 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list