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 47d59f247eefb74c1766471205b16aa4163079e9 (commit)
via 012b6dc99c9913288b17887f68c96c3a9c32c52c (commit)
from 369f17609e87bbb63fcc9e4c8cbb55f1dfdeeb04 (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=47d59f247eefb74c1766471205b16aa4163079e9
commit 47d59f247eefb74c1766471205b16aa4163079e9
Author: Sylvain Beucler <[email protected]>
Date: Fri Jun 19 17:52:19 2015 +0200
activity,widgets: add missing counterpart at scm.xxx
diff --git a/src/plugins/scmsvn/libexec/svnlog.php
b/src/plugins/scmsvn/libexec/svnlog.php
new file mode 100644
index 0000000..68ba36f
--- /dev/null
+++ b/src/plugins/scmsvn/libexec/svnlog.php
@@ -0,0 +1,86 @@
+<?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');
+ $d1 = date('Y-m-d', $start_time - 80000);
+ $d2 = date('Y-m-d', $end_time + 80000);
+ $options = "-r '{".$d2."}:{".$d1."}'";
+} else if ($mode == 'latest' or $mode == 'latest_user') {
+ $limit = $_GET['limit'];
+ if (!ctype_digit($limit))
+ die('Invalid limit');
+ $options = "--limit $limit";
+
+ 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 .= " --search '$user_name'";
+ }
+}
+
+$repo = forge_get_config('repos_path', 'scmsvn') . '/' . $unix_group_name;
+if (is_dir($repo)) {
+ passthru("svn log file://$repo --xml -v $options 2> /dev/null");
+}
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=012b6dc99c9913288b17887f68c96c3a9c32c52c
commit 012b6dc99c9913288b17887f68c96c3a9c32c52c
Author: Sylvain Beucler <[email protected]>
Date: Fri Jun 19 17:51:10 2015 +0200
widgets: make mylatestcommits and projectlatestcommits work with ITK (SVN)
diff --git a/src/plugins/scmsvn/common/SVNPlugin.class.php
b/src/plugins/scmsvn/common/SVNPlugin.class.php
index f218463..bb785a4 100644
--- a/src/plugins/scmsvn/common/SVNPlugin.class.php
+++ b/src/plugins/scmsvn/common/SVNPlugin.class.php
@@ -577,6 +577,7 @@ some control over it to the project's administrator.");
$script_url = $protocol . forge_get_config('scm_host')
. $server_script
.'?unix_group_name='.$project->getUnixName()
+ .'&mode=date_range'
.'&begin='.$params['begin']
.'&end='.$params['end'];
$ch = curl_init();
@@ -629,9 +630,8 @@ some control over it to the project's administrator.");
}
// Get latest commits for inclusion in a widget
- // TODO: make it work with ITK
function getCommits($project, $user = null, $nbCommits) {
- global $commits, $users, $adds, $updates, $messages, $times,
$revisions, $deletes, $time_ok, $user_list, $last_message, $notimecheck;
+ global $commits, $users, $adds, $updates, $messages, $times,
$revisions, $deletes, $time_ok, $user_list, $last_message, $notimecheck,
$xml_parser;
$commits = 0;
$users = array();
$adds = 0;
@@ -646,33 +646,51 @@ some control over it to the project's administrator.");
$notimecheck = true;
$revisionsArr = array();
if ($project->usesPlugin($this->name) &&
forge_check_perm('scm', $project->getID(), 'read')) {
- $repo = forge_get_config('repos_path', $this->name) .
'/' . $project->getUnixName();
+ $xml_parser = xml_parser_create();
+ xml_set_element_handler($xml_parser,
"SVNPluginStartElement", "SVNPluginEndElement");
+ xml_set_character_data_handler($xml_parser,
"SVNPluginCharData");
+
+ // Grab&parse commit log
+ $protocol = forge_get_config('use_ssl', 'scmsvn') ?
'https://' : 'http://';
+ $u = session_get_user();
+ if ($project->enableAnonSCM())
+ $server_script = '/anonscm/svnlog';
+ else
+ $server_script =
'/authscm/'.$u->getUnixName().'/svnlog';
if ($user) {
$userunixname = $user->getUnixName();
- $pipecmd = "svn log file://$repo --xml -v
--limit $nbCommits --search \"$userunixname\" 2> /dev/null";
+ $params =
'&mode=latest_user&user_name='.$userunixname;
} else {
- $pipecmd = "svn log file://$repo --xml -v
--limit $nbCommits 2> /dev/null";
+ $params = '&mode=latest';
}
- if (is_dir($repo)) {
- $pipe = popen($pipecmd, 'r' );
- $xml_parser = xml_parser_create();
- xml_set_element_handler($xml_parser,
"SVNPluginStartElement", "SVNPluginEndElement");
- xml_set_character_data_handler($xml_parser,
"SVNPluginCharData");
- while (!feof($pipe) && $data = fgets($pipe,
4096)) {
- if (!xml_parse($xml_parser, $data,
feof($pipe))) {
- $this->setError("Unable to
parse XML with error " .
-
xml_error_string(xml_get_error_code($xml_parser)) .
- " on line " .
-
xml_get_current_line_number($xml_parser));
- pclose($pipe);
- return false;
- break;
- }
-
- }
- xml_parser_free($xml_parser);
- pclose($pipe);
+ $script_url = $protocol . forge_get_config('scm_host')
+ . $server_script
+ .'?unix_group_name='.$project->getUnixName()
+ . $params
+ .'&limit='.$nbCommits;
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $script_url);
+ curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'curl2xml');
+ 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);
+
+ // final checks
+ if (!xml_parse($xml_parser, '', true))
+ exit_error('Unable to parse XML with error '
+ .
xml_error_string(xml_get_error_code($xml_parser))
+ . ' on line ' .
xml_get_current_line_number($xml_parser),
+ 'activity');
+ xml_parser_free($xml_parser);
+
if ($adds > 0 || $updates > 0 || $commits > 0 ||
$deletes > 0) {
$i = 0;
foreach ($messages as $message) {
-----------------------------------------------------------------------
Summary of changes:
src/plugins/scmsvn/common/SVNPlugin.class.php | 66 ++++++++++++--------
src/plugins/scmsvn/libexec/svnlog.php | 86 +++++++++++++++++++++++++++
2 files changed, 128 insertions(+), 24 deletions(-)
create mode 100644 src/plugins/scmsvn/libexec/svnlog.php
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits