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.1 has been updated
       via  37d161e118edf443e7d8bc1d6d53e3277e7cc43c (commit)
      from  bdc637f977d63ce63e58c5f1c85792ba1daa1e6c (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=37d161e118edf443e7d8bc1d6d53e3277e7cc43c

commit 37d161e118edf443e7d8bc1d6d53e3277e7cc43c
Author: Franck Villaume <[email protected]>
Date:   Tue Mar 13 09:37:42 2018 +0000

    scmgit: support activity for multirepository

diff --git a/src/plugins/scmgit/common/GitPlugin.class.php 
b/src/plugins/scmgit/common/GitPlugin.class.php
index cd59cb2..c37ba61 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -996,53 +996,57 @@ control over it to the project's administrator.");
                        } else {
                                return false;
                        }
-                       // Grab commit log
+                       $repo_list = $this->getRepositories($project);
                        $protocol = forge_get_config('use_ssl', 'scmgit') ? 
'https://' : 'http://';
-                       $script_url = 
$protocol.$this->getBoxForProject($project)
-                               . $server_script
-                               .'?unix_group_name='.$project->getUnixName()
-                               .'&mode=date_range'
-                               .'&begin='.$params['begin']
-                               .'&end='.$params['end'];
-                       $filename = tempnam('/tmp', 'gitlog');
-                       $f = fopen($filename, 'w');
-                       $ch = curl_init();
-                       curl_setopt($ch, CURLOPT_URL, $script_url);
-                       curl_setopt($ch, CURLOPT_FILE, $f);
-                       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-                       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
-                       curl_setopt($ch, CURLOPT_COOKIE, 
@$_SERVER['HTTP_COOKIE']);  // for session validation
-                       curl_setopt($ch, CURLOPT_USERAGENT, 
$_SERVER['HTTP_USER_AGENT']);  // for session validation
-                       curl_setopt($ch, CURLOPT_HTTPHEADER,
-                                               array('X-Forwarded-For: 
'.$_SERVER['REMOTE_ADDR']));  // for session validation
-                       $body = curl_exec($ch);
-                       if ($body === false) {
-                               $this->setError(curl_error($ch));
-                       }
-                       curl_close($ch);
-                       fclose($f); // flush buffer
-                       $f = fopen($filename, 'r');
-                       unlink($filename);
-
-                       while (!feof($f) && $data = fgets($f)) {
-                               $line = trim($data);
-                               $splitedLine = explode('||', $line);
-                               if (sizeof($splitedLine) == 4) {
-                                       $result = array();
-                                       $result['section'] = 'scm';
-                                       $result['group_id'] = $project->getID();
-                                       $result['ref_id'] = 
'browser.php?group_id='.$project->getID().'&scm_plugin='.$this->name.'&commit='.$splitedLine[3];
-                                       $result['description'] = 
htmlspecialchars($splitedLine[2]).' (commit '.$splitedLine[3].')';
-                                       $userObject = 
user_get_object_by_email($splitedLine[1]);
-                                       if (is_a($userObject, 'FFUser')) {
-                                               $result['realname'] = 
util_display_user($userObject->getUnixName(), $userObject->getID(), 
$userObject->getRealName());
-                                       } else {
-                                               $result['realname'] = '';
+                       foreach ($repo_list as $repo_name) {
+                               // Grab commit log
+                               $script_url = 
$protocol.$this->getBoxForProject($project)
+                                       . $server_script
+                                       
.'?unix_group_name='.$project->getUnixName()
+                                       .'&repo_name='.$repo_name
+                                       .'&mode=date_range'
+                                       .'&begin='.$params['begin']
+                                       .'&end='.$params['end'];
+                               $filename = tempnam('/tmp', 'gitlog');
+                               $f = fopen($filename, 'w');
+                               $ch = curl_init();
+                               curl_setopt($ch, CURLOPT_URL, $script_url);
+                               curl_setopt($ch, CURLOPT_FILE, $f);
+                               curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+                               curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+                               curl_setopt($ch, CURLOPT_COOKIE, 
@$_SERVER['HTTP_COOKIE']);  // for session validation
+                               curl_setopt($ch, CURLOPT_USERAGENT, 
$_SERVER['HTTP_USER_AGENT']);  // for session validation
+                               curl_setopt($ch, CURLOPT_HTTPHEADER,
+                                                       array('X-Forwarded-For: 
'.$_SERVER['REMOTE_ADDR']));  // for session validation
+                               $body = curl_exec($ch);
+                               if ($body === false) {
+                                       $this->setError(curl_error($ch));
+                               }
+                               curl_close($ch);
+                               fclose($f); // flush buffer
+                               $f = fopen($filename, 'r');
+                               unlink($filename);
+
+                               while (!feof($f) && $data = fgets($f)) {
+                                       $line = trim($data);
+                                       $splitedLine = explode('||', $line);
+                                       if (sizeof($splitedLine) == 4) {
+                                               $result = array();
+                                               $result['section'] = 'scm';
+                                               $result['group_id'] = 
$project->getID();
+                                               $result['ref_id'] = 
'browser.php?group_id='.$project->getID().'&scm_plugin='.$this->name.'&commit='.$splitedLine[3];
+                                               $result['description'] = 
htmlspecialchars($splitedLine[2]).' (repository: '.$repo_name.' commit: 
'.$splitedLine[3].')';
+                                               $userObject = 
user_get_object_by_email($splitedLine[1]);
+                                               if (is_a($userObject, 
'FFUser')) {
+                                                       $result['realname'] = 
util_display_user($userObject->getUnixName(), $userObject->getID(), 
$userObject->getRealName());
+                                               } else {
+                                                       $result['realname'] = 
'';
+                                               }
+                                               $splitedDate = explode(' ', 
$splitedLine[0]);
+                                               $result['activity_date'] = 
$splitedDate[0];
+                                               $result['subref_id'] = '';
+                                               $params['results'][] = $result;
                                        }
-                                       $splitedDate = explode(' ', 
$splitedLine[0]);
-                                       $result['activity_date'] = 
$splitedDate[0];
-                                       $result['subref_id'] = '';
-                                       $params['results'][] = $result;
                                }
                        }
                }
diff --git a/src/plugins/scmgit/libexec/gitlog.php 
b/src/plugins/scmgit/libexec/gitlog.php
index b5a8a11..857e440 100644
--- a/src/plugins/scmgit/libexec/gitlog.php
+++ b/src/plugins/scmgit/libexec/gitlog.php
@@ -49,11 +49,14 @@ if (!preg_match(',^/anonscm/,', $_SERVER['REQUEST_URI'])) {
 
 
 $unix_group_name = $_GET['unix_group_name'];
+$repo_name = $_GET['repo_name'];
 $mode = $_GET['mode'];
 if (!preg_match('/^(date_range|latest|latest_user)$/', $mode))
        die('Invalid mode');
 if (!preg_match('/^[a-z0-9][-a-z0-9_\.]+\z/', $unix_group_name))
        die('Invalid group name');
+if (!preg_match('/^[a-z0-9][-a-z0-9_\.]+\z/', $repo_name))
+       die('Invalid repository name');
 
 if ($mode == 'date_range') {
        $start_time = $_GET['begin'];
@@ -82,7 +85,7 @@ if ($mode == 'date_range') {
        }
 }
 
-$repo = forge_get_config('repos_path', 'scmgit') . 
"/$unix_group_name/$unix_group_name.git";
+$repo = forge_get_config('repos_path', 'scmgit') . 
"/$unix_group_name/$repo_name.git";
 if (is_dir($repo)) {
        passthru("GIT_DIR=\"$repo\" git log --date=raw --all 
--pretty='format:%ad||%ae||%s||%h' --name-status $options");
 }

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

Summary of changes:
 src/plugins/scmgit/common/GitPlugin.class.php | 94 ++++++++++++++-------------
 src/plugins/scmgit/libexec/gitlog.php         |  5 +-
 2 files changed, 53 insertions(+), 46 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to