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 f0960b1e0e6cbd05223ce8a9635f771d446fc135 (commit)
from bb9db4053e830ddffe8d52ac730285a767f3a2f2 (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=f0960b1e0e6cbd05223ce8a9635f771d446fc135
commit f0960b1e0e6cbd05223ce8a9635f771d446fc135
Author: Franck Villaume <[email protected]>
Date: Thu Jun 15 08:58:21 2017 +0000
mediawiki plugin: support activity for public project
diff --git a/src/CHANGES b/src/CHANGES
index 3f5d749..bf81925 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -20,6 +20,7 @@ FusionForge 6.X:
* Plugin AuthBuiltin: add captcha after 3 attempts with the same login [#795]
(TrivialDev)
* Plugin AuthLDAP: support X_FORWARD_USER to delegate authentication and then
retrieve user from LDAP (TrivialDev)
* Plugin GlobalActivity: forge-wide aggregation for project activities (Roland
Mas)
+* Plugin Mediawiki: support activity for public project (TrivialDev)
* Projects Page: add paging system in full_list and tag_cloud subpages
(TrivialDev)
* SearchEngine: support only FTI queries (TrivialDev)
* Search: index project tags and use them for search (Roland Mas)
diff --git a/src/plugins/mediawiki/common/mediawikiPlugin.class.php
b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
index 4d5f7aa..22cc455 100644
--- a/src/plugins/mediawiki/common/mediawikiPlugin.class.php
+++ b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
@@ -373,42 +373,53 @@ _('This plugin allows each project to embed Mediawiki
under a tab.');
return false;
}
if (in_array($this->name, $params['show']) ||
(count($params['show']) < 1)) {
- $protocol = forge_get_config('use_ssl') ?
'https://' : 'http://';
- $script_url =
$protocol.forge_get_config('web_host').'/plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/api.php'
- .'?action=query'
- .'&list=recentchanges'
- .'&format=json'
-
.'&rcstart='.date('Y-m-d\TH:i:s\Z',$params['end'])
-
.'&rcend='.date('Y-m-d\TH:i:s\Z',$params['begin']);
- $filename = tempnam('/tmp', 'mediawikilog');
- $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)) {
- $result = array();
- $result['section'] = 'mediawiki';
- $result['group_id'] = $group_id;
- $result['ref_id'] = 'something';
- $result['description'] = 'yeah';
- $result['activity_date'] = 0;
- $result['subref_id'] = '';
- $params['results'][] = $result;
- }
+ $protocol = forge_get_config('use_ssl') ?
'https://' : 'http://';
+ $script_url =
$protocol.forge_get_config('web_host').forge_get_config('url_prefix').'/plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/api.php'
+ .'?action=query'
+ .'&list=recentchanges'
+ .'&format=json'
+
.'&rcstart='.date('Y-m-d\TH:i:s\Z',$params['end'])
+
.'&rcend='.date('Y-m-d\TH:i:s\Z',$params['begin']);
+ $filename = tempnam('/tmp', 'mediawikilog');
+ $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
+ $jsoncontent =
(array)json_decode(file_get_contents($filename), true);
+ unlink($filename);
+ if
(isset($jsoncontent['query']['recentchanges'])) {
+
foreach($jsoncontent['query']['recentchanges'] as $recentchanges) {
+ $result = array();
+ $result['section'] =
'mediawiki';
+ $result['group_id'] =
$group_id;
+ $result['activity_date'] =
strtotime($recentchanges['timestamp']);
+ $result['link'] =
forge_get_config('url_prefix').'plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/index.php/'.str_replace('
', '_',
+ $recentchanges['title']);
+ $title = 'Mediawiki ';
+ if ($recentchanges['type'] ==
'new') {
+ $title .= _('new
element created')._(': ');
+ } else if
($recentchanges['type'] == 'edit') {
+ $title .= _('modified
element')._(': ');
+ } else if
($recentchanges['type'] == 'log') {
+ $title .= _('stored
element')._(': ');
+ }
+ $title .=
$recentchanges['title'];
+ $result['title'] = $title;
+ $params['results'][] = $result;
+ }
+ }
}
if (!in_array($this->name, $params['ids'])) {
$params['ids'][] = $this->name;
diff --git a/src/www/activity/index.php b/src/www/activity/index.php
index 05aed4a..e3d921b 100644
--- a/src/www/activity/index.php
+++ b/src/www/activity/index.php
@@ -277,6 +277,9 @@ echo $HTML->closeForm();
$cached_perms[$s][$ref] =
forge_check_perm('docman', $group_id, 'read');
break;
}
+ case 'mediawiki':
+ $cached_perms[$s][$ref] =
forge_check_perm('plugin_mediawiki_read', $group_id, 'read');
+ break;
default: {
// Must be a bug somewhere,
we're supposed to handle all types
$cached_perms[$s][$ref] = false;
-----------------------------------------------------------------------
Summary of changes:
src/CHANGES | 1 +
.../mediawiki/common/mediawikiPlugin.class.php | 83 ++++++++++++----------
src/www/activity/index.php | 3 +
3 files changed, 51 insertions(+), 36 deletions(-)
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits