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 e21617adba69971d48612f154e59cd2371481559 (commit)
via 5d95bf4fcbb2969642d66ce6829e31b16a7e5ee0 (commit)
from 47d59f247eefb74c1766471205b16aa4163079e9 (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=e21617adba69971d48612f154e59cd2371481559
commit e21617adba69971d48612f154e59cd2371481559
Author: Sylvain Beucler <[email protected]>
Date: Mon Jun 22 15:57:56 2015 +0200
widgets: make mylatestcommits and projectlatestcommits work with ITK (Git)
diff --git a/src/CHANGES b/src/CHANGES
index 746761f..e15cc43 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -11,7 +11,9 @@ FusionForge 6.0.1:
* Tracker: provide a "Submit" button below the "add a comment" field [#776]
(TrivialDev)
* Tracker: on item update, notify users who monitor the whole tracker (Inria)
* Tracker/FRS/Docman/Forum: allow viewing text and image files within the
browser [#773] (Inria)
+* Activity: commit log now works with private projects (Inria)
* Widgets: MyProjects: only display active projects (Inria)
+* Widgets: MyLatestCommits, ProjectLatestCommits: now works with private
projects (Inria)
* SCM SVN: fix double-compression in ViewVC (Inria)
* SCM SVN: support files with spaces in ViewVC (Inria)
* SCM SVN: fix permissions in migration script (Inria)
diff --git a/src/plugins/scmgit/common/GitPlugin.class.php
b/src/plugins/scmgit/common/GitPlugin.class.php
index 1d67412..18ce98b 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -1186,33 +1186,60 @@ control over it to the project's administrator.");
function getCommits($project, $user = null, $nb_commits) {
$commits = array();
if ($project->usesPlugin($this->name) &&
forge_check_perm('scm', $project->getID(), 'read')) {
- $repo = forge_get_config('repos_path', $this->name) .
'/' . $project->getUnixName() . '/' . $project->getUnixName() . '.git';
+ // Grab&parse commit log
+ $protocol = forge_get_config('use_ssl', 'scmgit') ?
'https://' : 'http://';
+ $u = session_get_user();
+ if ($project->enableAnonSCM())
+ $server_script = '/anonscm/gitlog';
+ else
+ $server_script =
'/authscm/'.$u->getUnixName().'/gitlog';
if ($user) {
$email = $user->getEmail();
- $fullname = $user->getFirstName().'
'.$user->getLastName();
+ $realname = $user->getFirstName().'
'.$user->getLastName();
$userunixname = $user->getUnixName();
- $pipecmd = "GIT_DIR=\"$repo\" git log
--date=raw --all --pretty='format:%ad||%ae||%s||%h' --name-status
--max-count=$nb_commits --author=\"$email\" --author=\"$fullname\"
--author=\"$userunixname\"";
-
+ $params = '&mode=latest_user'
+ .'&email='.urlencode($email)
+ .'&realname='.urlencode($realname)
+ .'&user_name='.$userunixname;
} else {
- $pipecmd = "GIT_DIR=\"$repo\" git log
--date=raw --all --pretty='format:%ad||%ae||%s||%h' --name-status
--max-count=$nb_commits";
-
+ $params = '&mode=latest';
}
- if (is_dir($repo)) {
- $pipe = popen($pipecmd, 'r' );
- $i = 0;
- while (!feof($pipe) && $data = fgets($pipe)) {
- $line = trim($data);
- $splitedLine = explode('||', $line);
- if (sizeof($splitedLine) == 4) {
- $commits[$i]['pluginName'] =
$this->name;
- $commits[$i]['description'] =
htmlspecialchars($splitedLine[2]);
- $commits[$i]['commit_id'] =
$splitedLine[3];
- $splitedDate = explode(' ',
$splitedLine[0]);
- $commits[$i]['date'] =
$splitedDate[0];
- $i++;
- }
+ $script_url = $protocol . forge_get_config('scm_host')
+ . $server_script
+ .'?unix_group_name='.$project->getUnixName()
+ . $params
+ .'&limit='.$nb_commits;
+ $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) {
+ $commits[$i]['pluginName'] =
$this->name;
+ $commits[$i]['description'] =
htmlspecialchars($splitedLine[2]);
+ $commits[$i]['commit_id'] =
$splitedLine[3];
+ $splitedDate = explode(' ',
$splitedLine[0]);
+ $commits[$i]['date'] = $splitedDate[0];
+ $i++;
}
- pclose($pipe);
}
}
return $commits;
diff --git a/src/plugins/scmgit/libexec/gitlog.php
b/src/plugins/scmgit/libexec/gitlog.php
index 46a0e75..873d3e4 100644
--- a/src/plugins/scmgit/libexec/gitlog.php
+++ b/src/plugins/scmgit/libexec/gitlog.php
@@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-// Don't try to connect to the DB, just redirecting SVN URL
+// Don't try to connect to the DB, just dumping Git log
putenv('FUSIONFORGE_NO_DB=true');
require_once '../../../www/env.inc.php';
@@ -68,13 +68,18 @@ if ($mode == 'date_range') {
$limit = $_GET['limit'];
if (!ctype_digit($limit))
die('Invalid limit');
- $options = "--max-count=$nb_commits";
+ $options = "--max-count=$limit";
if ($mode == 'latest_user') {
+ $email = $_GET['email'];
+ $realname = $_GET['realname'];
$user_name = $_GET['user_name'];
+ if (!validate_email($email))
+ die('Invalid email');
+ $realname = escapeshellarg(preg_quote($realname));
if (!preg_match('/^[a-z0-9][-a-z0-9_\.]+\z/', $user_name))
die('Invalid user name');
- $options .= " --author=\"$email\" --author=\"$fullname\"
--author=\"$userunixname\"";
+ $options .= " --author='$email' --author=$realname
--author='$user_name'";
}
}
@@ -82,4 +87,3 @@ $repo = forge_get_config('repos_path', 'scmgit') .
"/$unix_group_name/$unix_grou
if (is_dir($repo)) {
passthru("GIT_DIR=\"$repo\" git log --date=raw --all
--pretty='format:%ad||%ae||%s||%h' --name-status $options");
}
-
diff --git a/src/plugins/scmsvn/libexec/svnlog.php
b/src/plugins/scmsvn/libexec/svnlog.php
index 68ba36f..440bfc0 100644
--- a/src/plugins/scmsvn/libexec/svnlog.php
+++ b/src/plugins/scmsvn/libexec/svnlog.php
@@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-// Don't try to connect to the DB, just redirecting SVN URL
+// Don't try to connect to the DB, just dumping SVN log
putenv('FUSIONFORGE_NO_DB=true');
require_once '../../../www/env.inc.php';
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=5d95bf4fcbb2969642d66ce6829e31b16a7e5ee0
commit 5d95bf4fcbb2969642d66ce6829e31b16a7e5ee0
Author: Sylvain Beucler <[email protected]>
Date: Mon Jun 22 15:16:44 2015 +0200
activity: first stab at remote git log
diff --git a/src/plugins/scmgit/common/GitPlugin.class.php
b/src/plugins/scmgit/common/GitPlugin.class.php
index 878e705..1d67412 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -962,31 +962,61 @@ control over it to the project's administrator.");
return false;
}
if (in_array('scmgit', $params['show']) ||
(count($params['show']) < 1)) {
- $repo = forge_get_config('repos_path', 'scmgit') . '/'
. $project->getUnixName() . '/' . $project->getUnixName() . '.git';
- if (is_dir($repo) && is_dir($repo.'/refs')) {
- $start_time = $params['begin'];
- $end_time = $params['end'];
- $pipe = popen("GIT_DIR=\"$repo\" git log
--date=raw --since=@$start_time --until=@$end_time --all
--pretty='format:%ad||%ae||%s||%h' --name-status", 'r' );
- while (!feof($pipe) && $data = fgets($pipe)) {
- $line = trim($data);
- $splitedLine = explode('||', $line);
- if (sizeof($splitedLine) == 4) {
- $result = array();
- $result['section'] = 'scm';
- $result['group_id'] = $group_id;
- $result['ref_id'] =
'browser.php?group_id='.$group_id.'&commit='.$splitedLine[3];
- $result['description'] =
htmlspecialchars($splitedLine[2]).' (commit '.$splitedLine[3].')';
- $userObject =
user_get_object_by_email($splitedLine[1]);
- if (is_a($userObject,
'GFUser')) {
- $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;
+ $start_time = $params['begin'];
+ $end_time = $params['end'];
+
+ // Grab commit log
+ $protocol = forge_get_config('use_ssl', 'scmgit') ?
'https://' : 'http://';
+ $u = session_get_user();
+ if ($project->enableAnonSCM())
+ $server_script = '/anonscm/gitlog';
+ else
+ $server_script =
'/authscm/'.$u->getUnixName().'/gitlog';
+ $script_url = $protocol . forge_get_config('scm_host')
+ . $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'] = $group_id;
+ $result['ref_id'] =
'browser.php?group_id='.$group_id.'&commit='.$splitedLine[3];
+ $result['description'] =
htmlspecialchars($splitedLine[2]).' (commit '.$splitedLine[3].')';
+ $userObject =
user_get_object_by_email($splitedLine[1]);
+ if (is_a($userObject, 'GFUser')) {
+ $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;
}
}
}
diff --git a/src/plugins/scmgit/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc
b/src/plugins/scmgit/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc
index 0e6e19d..e3ed22e 100644
--- a/src/plugins/scmgit/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc
+++ b/src/plugins/scmgit/etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc
@@ -43,6 +43,14 @@ ScriptAlias /anonscm/gitweb
${FF__core__plugins_path}/scmgit/cgi-bin/gitweb.cgi
ScriptAliasMatch ^/authscm/[^/]+/gitweb/$
${FF__core__plugins_path}/scmgit/cgi-bin/gitweb.cgi
+# Activity
+ScriptAliasMatch ^/authscm/[^/]+/gitlog(.*)
${FF__core__plugins_path}/scmgit/libexec/gitlog.php$1
+# Authentified via cookie in gitlog.php:
+<LocationMatch "^/authscm/[^/]+/gitlog">
+ Satisfy Any
+</LocationMatch>
+ScriptAlias /anonscm/gitlog ${FF__core__plugins_path}/scmgit/libexec/gitlog.php
+
# Redirect URLs from FF < 6.0 (scm_host -> scm_host)
# - use_ssh=1 => /anonscm/git -> /anonscm/git
# => OK
diff --git a/src/plugins/scmgit/libexec/gitlog.php
b/src/plugins/scmgit/libexec/gitlog.php
new file mode 100644
index 0000000..46a0e75
--- /dev/null
+++ b/src/plugins/scmgit/libexec/gitlog.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Returns commit log for inclusion in web frontend
+ *
+ * Copyright 2015 Inria (Sylvain Beucler)
+ *
+ * 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 License,
+ * 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// Don't try to connect to the DB, just redirecting SVN URL
+putenv('FUSIONFORGE_NO_DB=true');
+
+require_once '../../../www/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+
+header('Content-type: text/plain');
+
+# Authentify request
+if (!preg_match(',^/anonscm/,', $_SERVER['REQUEST_URI'])) {
+ $web_host = forge_get_config('web_host');
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, 'https://' . $web_host .
'/account/check_forwarded_session.php');
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+ curl_setopt($ch, CURLOPT_COOKIE, $_SERVER['HTTP_COOKIE']);
+ curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Forwarded-For:
'.$_SERVER['HTTP_X_FORWARDED_FOR']));
+ //$info = curl_getinfo($ch);
+ $body = curl_exec($ch);
+ curl_close($ch);
+ if ($body != 'OK') {
+ die($body);
+ }
+}
+
+
+$unix_group_name = $_GET['unix_group_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 ($mode == 'date_range') {
+ $start_time = $_GET['begin'];
+ $end_time = $_GET['end'];
+ if (!ctype_digit($start_time))
+ die('Invalid start time');
+ if (!ctype_digit($end_time))
+ die('Invalid end time');
+ $options = "--since=@$start_time --until=@$end_time";
+} else if ($mode == 'latest' or $mode == 'latest_user') {
+ $limit = $_GET['limit'];
+ if (!ctype_digit($limit))
+ die('Invalid limit');
+ $options = "--max-count=$nb_commits";
+
+ if ($mode == 'latest_user') {
+ $user_name = $_GET['user_name'];
+ if (!preg_match('/^[a-z0-9][-a-z0-9_\.]+\z/', $user_name))
+ die('Invalid user name');
+ $options .= " --author=\"$email\" --author=\"$fullname\"
--author=\"$userunixname\"";
+ }
+}
+
+$repo = forge_get_config('repos_path', 'scmgit') .
"/$unix_group_name/$unix_group_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/CHANGES | 2 +
src/plugins/scmgit/common/GitPlugin.class.php | 147 ++++++++++++++-------
.../etc/httpd.conf.d/vhost-scm-plugin-scmgit.inc | 8 ++
.../svnlog.php => scmgit/libexec/gitlog.php} | 19 +--
src/plugins/scmsvn/libexec/svnlog.php | 2 +-
5 files changed, 124 insertions(+), 54 deletions(-)
copy src/plugins/{scmsvn/libexec/svnlog.php => scmgit/libexec/gitlog.php} (80%)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits