[Fusionforge-commits] FusionForge branch 6.0 updated. 20b72c5d6b0e5001b9f21752493c65c717e80047

Sylvain Beucler beuc-inria at fusionforge.org
Thu Feb 12 16:54:29 CET 2015


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  20b72c5d6b0e5001b9f21752493c65c717e80047 (commit)
       via  6cb71b280410b565bc3398879e9c0eb5698544ce (commit)
      from  36b165d91d54dbf01ddf79ed288bc79e5f0914e9 (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 20b72c5d6b0e5001b9f21752493c65c717e80047
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Thu Feb 12 16:54:03 2015 +0100

    reactivity: regen SCM auth files when adding/removing project members

diff --git a/src/common/include/RBAC.php b/src/common/include/RBAC.php
index bc58c48..155e622 100644
--- a/src/common/include/RBAC.php
+++ b/src/common/include/RBAC.php
@@ -1101,6 +1101,11 @@ abstract class RoleExplicit extends BaseRole implements PFO_RoleExplicit {
 			}
 		}
 
+		$systasksq = new SysTasksQ();
+		foreach ($this->getLinkedProjects() as $project) {
+			$systasksq->add(SYSTASK_CORE, 'SCM_REPO', $project->getID());
+		}
+
 		return true;
 	}
 
@@ -1133,6 +1138,11 @@ abstract class RoleExplicit extends BaseRole implements PFO_RoleExplicit {
 			}
 		}
 
+		$systasksq = new SysTasksQ();
+		foreach ($this->getLinkedProjects() as $project) {
+			$systasksq->add(SYSTASK_CORE, 'SCM_REPO', $project->getID());
+		}
+
 		return true ;
 	}
 

commit 6cb71b280410b565bc3398879e9c0eb5698544ce
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Thu Feb 12 16:53:10 2015 +0100

    reactivity: don't pile up identical systasks

diff --git a/src/common/include/SysTasksQ.class.php b/src/common/include/SysTasksQ.class.php
index 4106351..8e5dddd 100644
--- a/src/common/include/SysTasksQ.class.php
+++ b/src/common/include/SysTasksQ.class.php
@@ -2,7 +2,7 @@
 /**
  * FusionForge system action queue
  *
- * Copyright (C) 2014  Inria (Sylvain Beucler)
+ * Copyright (C) 2014, 2015  Inria (Sylvain Beucler)
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -25,21 +25,41 @@
 define('SYSTASK_CORE', null);
 
 class SysTasksQ extends Error {
-		function add($plugin_id, $systask_type, $group_id, $user_id=null) {
-				$res = db_query_params('INSERT INTO systasks (
-				    plugin_id,
-				    systask_type,
-				    group_id,
-				    user_id,
-				    requested
-				  ) VALUES ($1, $2, $3, $4, now())',
-				  array($plugin_id, $systask_type, $group_id, $user_id));
-				if (!$res || db_affected_rows($res) < 1) {
-						$this->setError(sprintf(_('Error: Cannot create system action: %s'),
-												db_error()));
-						return false;
-				}
+	function add($plugin_id, $systask_type, $group_id, $user_id=null) {
+		// Trim duplicate requests, e.g. SCM_REPO ones
+		$qpa = db_construct_qpa();
+		$qpa = db_construct_qpa($qpa, 'SELECT FROM systasks WHERE status=$1', array('TODO'));
+		$qpa = db_construct_qpa($qpa, ' AND systask_type=$1', array($systask_type));
+		if ($plugin_id == null) $qpa = db_construct_qpa($qpa, ' AND plugin_id IS NULL');
+		else                    $qpa = db_construct_qpa($qpa, ' AND plugin_id=$1', array($plugin_id));
+		if ($group_id == null)  $qpa = db_construct_qpa($qpa, ' AND group_id IS NULL');
+		else                    $qpa = db_construct_qpa($qpa, ' AND group_id=$1', array($group_id));
+		if ($user_id == null)   $qpa = db_construct_qpa($qpa, ' AND user_id IS NULL');
+		else                    $qpa = db_construct_qpa($qpa, ' AND user_id=$1', array($user_id));
+		$res = db_query_qpa($qpa);
+		if (!$res) {
+			$this->setError(sprintf(_('Error: Cannot create system action: %s'),
+									db_error()));
+			return false;
 		}
+		if (db_numrows($res) >= 1)
+			return true;
+		
+		$res = db_query_params(
+			'INSERT INTO systasks (
+				plugin_id,
+				systask_type,
+				group_id,
+				user_id,
+				requested
+			) VALUES ($1, $2, $3, $4, now())',
+			array($plugin_id, $systask_type, $group_id, $user_id));
+		if (!$res || db_affected_rows($res) < 1) {
+			$this->setError(sprintf(_('Error: Cannot create system action: %s'),
+									db_error()));
+			return false;
+		}
+	}
 }
 
 // Local Variables:

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

Summary of changes:
 src/common/include/RBAC.php            |   10 +++++++
 src/common/include/SysTasksQ.class.php |   50 ++++++++++++++++++++++----------
 2 files changed, 45 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list