[Fusionforge-commits] r14630 - in trunk: . src/etc/httpd.conf.d src/plugins/moinmoin/bin src/plugins/moinmoin/common src/plugins/moinmoin/cronjobs src/plugins/moinmoin/etc src/plugins/moinmoin/lib src/plugins/moinmoin/packaging/cron.d

Roland Mas lolando at fusionforge.org
Fri Oct 14 18:03:45 CEST 2011


Author: lolando
Date: 2011-10-14 18:03:45 +0200 (Fri, 14 Oct 2011)
New Revision: 14630

Added:
   trunk/src/plugins/moinmoin/common/MoinMoinPlugin.class.php
   trunk/src/plugins/moinmoin/common/moinmoin-init.php
   trunk/src/plugins/moinmoin/lib/fusionforge.py
   trunk/src/plugins/moinmoin/packaging/cron.d/plugin-moinmoin
Removed:
   trunk/src/plugins/moinmoin/bin/mw-drop-wikis.php
   trunk/src/plugins/moinmoin/bin/mw-plugin-init.php
   trunk/src/plugins/moinmoin/bin/mw-wrapper.php
   trunk/src/plugins/moinmoin/common/MediaWikiPlugin.class.php
   trunk/src/plugins/moinmoin/common/mediawiki-init.php
   trunk/src/plugins/moinmoin/cronjobs/create-imagedirs.php
   trunk/src/plugins/moinmoin/lib/fusionforge_session.py
   trunk/src/plugins/moinmoin/packaging/cron.d/plugin-mediawiki
Modified:
   trunk/
   trunk/src/etc/httpd.conf.d/plugin-moinmoin.inc
   trunk/src/plugins/moinmoin/cronjobs/create-wikis.php
   trunk/src/plugins/moinmoin/etc/wikiconfig.py
Log:
Multi-wiki configuration (incomplete)

Modified: trunk/src/etc/httpd.conf.d/plugin-moinmoin.inc
===================================================================
--- trunk/src/etc/httpd.conf.d/plugin-moinmoin.inc	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/etc/httpd.conf.d/plugin-moinmoin.inc	2011-10-14 16:03:45 UTC (rev 14630)
@@ -12,4 +12,4 @@
 </Directory>
 
 WSGIProcessGroup fusionforge-plugin-moinmoin
-WSGIScriptAlias /plugins/moinmoin "/usr/share/gforge/plugins/moinmoin/wsgi/moin.wsgi"
+WSGIScriptAliasMatch /plugins/moinmoin/[-_a-zA-Z0-9]*/.* "/usr/share/gforge/plugins/moinmoin/wsgi/moin.wsgi"

Deleted: trunk/src/plugins/moinmoin/bin/mw-drop-wikis.php
===================================================================
--- trunk/src/plugins/moinmoin/bin/mw-drop-wikis.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/bin/mw-drop-wikis.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,60 +0,0 @@
-#! /usr/bin/php
-<?php
-/* 
- * Copyright (C) 2010  Olaf Lenz
- *
- * 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.
- */
-
-  /** This script will destroy a mediawiki instance of a specific project.     */
-if ($argc < 2 ) {
-	echo "Usage " . $argv[0] . " <project>\n";
-	exit (0);
-}
-
-require_once dirname(__FILE__) . '/../../../www/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-
-$projects_path = forge_get_config('projects_path', 'mediawiki');
-
-array_shift($argv);
-foreach ($argv as $project) {
-  echo "Removing project wiki of $project.\n";
-
-  $project_dir = "$projects_path/$project";
-  echo "  Deleting project subdir $project_dir.\n";
-  if (!is_dir($project_dir)) {
-    echo "$project_dir does not exist!\n";
-  } else {
-    system("rm -rf $project_dir");
-  }
-
-  $schema = "plugin_mediawiki_$project";
-  strtr($schema, "-", "_");
-  echo "  Dropping database schema $schema.\n";
-  $res = db_query_params("DROP SCHEMA $schema CASCADE", array());
-  if (!$res) {
-    echo db_error();
-  }
-}
-
-  // Local Variables:
-  // mode: php
-  // c-file-style: "bsd"
-  // End:
-
-?>

Deleted: trunk/src/plugins/moinmoin/bin/mw-plugin-init.php
===================================================================
--- trunk/src/plugins/moinmoin/bin/mw-plugin-init.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/bin/mw-plugin-init.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,132 +0,0 @@
-#! /usr/bin/php
-<?php
-/* 
- * Copyright (C) 2010  Olaf Lenz
- *
- * 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.
- */
-
-  /** This script will set up the structure required to use the
-   mediawiki plugin. 
-  */
-
-require_once dirname(__FILE__) . '/../../../www/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-
-$echo_links = $argc >= 1;
-
-$master_path = forge_get_config('master_path', 'mediawiki');
-$projects_path = forge_get_config('projects_path', 'mediawiki');
-$src_path = forge_get_config('src_path', 'mediawiki');
-
-# create directories
-if (!is_dir($projects_path)) {
-	echo "Creating $projects_path...\n";
-	mkdir($projects_path, 0755, true);
-}
-
-if (!is_dir($master_path)) {
-	echo "Creating $master_path...\n";
-	mkdir($master_path, 0755, true);
-}
-
-function mysymlink($from, $to) {
-	global $echo_links;
-	if (!@symlink($from, $to)) {
-		echo "Could not create symbolic link from $from to $to.\n";
-	}
-	if ($echo_links) {
-		echo "$from $to\n";
-	}
-}
-
-
-# install links in master
-echo "Creating symlinks from $master_path to $src_path...\n";
-if (!($dh = opendir($src_path))) {
-	echo "Could not open mediawiki source directory $src_path!\n";
-} else {
-	$ignore_file = array( 
-		'.' => true, 
-		'..' => true,
-		'config' => true,
-		'skins' => true,
-		'images' => true,
-		'tests' => true,
-		't' => true,
-		);
-	while ($file = readdir($dh)) {
-		if (!$ignore_file[$file]) {
-			$from = "$src_path/$file";
-			$to = "$master_path/$file";
-			mysymlink($from, $to);
-		}
-	}
-	closedir ($dh);
-}
-
-// link LocalSettings.php from forge_get_config('source_path')/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
-$from = forge_get_config('source_path')."/plugins/mediawiki/www/LocalSettings.php";
-$to = "$master_path/LocalSettings.php";
-mysymlink($from, $to);
-
-// create skin directory
-$todir = "$master_path/skins";
-if (!is_dir($todir)) {
-	mkdir($todir);
-}
-
-// link FusionForge skin file
-$fromdir = forge_get_config('source_path')."/plugins/mediawiki/mediawiki-skin";
-$from = "$fromdir/FusionForge.php";
-$to = "$todir/FusionForge.php";
-mysymlink($from, $to);
-
-// create skin subdir
-$todir = "$todir/fusionforge";
-if (!is_dir($todir))
-	mkdir($todir);
-
-// link fusionforge.css files
-$fromdir = "$fromdir/fusionforge";
-$from = "$fromdir/fusionforge.css";
-$to = "$todir/fusionforge.css";
-mysymlink($from, $to);
-
-// link the rest of the files from monobook skin
-$fromdir = "$mediawiki_src_path/skins/monobook";
-
-$dh = opendir($fromdir);
-$ignore_file = array( 
-	'.' => true, 
-	'..' => true,
-	);
-while ($file = readdir($dh)) {
-	if (!$ignore_file[$file]) {
-		$from = "$fromdir/$file";
-		$to = "$todir/$file";
-		mysymlink($from, $to);
-	}
-}
-closedir($dh);
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-?>

Deleted: trunk/src/plugins/moinmoin/bin/mw-wrapper.php
===================================================================
--- trunk/src/plugins/moinmoin/bin/mw-wrapper.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/bin/mw-wrapper.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,69 +0,0 @@
-#! /usr/bin/php -f
-<?php
-/**
- * FusionForge/Mediawiki integration
- *
- * Copyright 2010, Roland Mas
- *
- * 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.
- */
-
-if (count ($argv) < 3) {
-        echo "Usage: .../mw-wrapper.php <project> <script> [ arguments... ]
-For instance: .../mw-wrapper.php siteadmin importDump.php /tmp/wikidump.xml
-              .../mw-wrapper.php siteadmin rebuildrecentchanges.php
-" ;
-        exit (1) ;
-}
-
-$wrapperscript = array_shift ($argv) ;
-$fusionforgeproject = array_shift ($argv) ;
-$mwscript = array_shift ($argv) ;
-
-require_once dirname(__FILE__) . '/../../../www/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-require_once $gfcommon.'include/cron_utils.php';
-
-// Plugins subsystem
-require_once($gfcommon.'include/Plugin.class.php');
-require_once($gfcommon.'include/PluginManager.class.php');
-
-setup_plugin_manager () ;
-
-$group = group_get_object_by_name($fusionforgeproject) ;
-if (!$group || $group->isError()) {
-	die ("Wrong group!\n") ;
-}
-
-if (!$group->usesPlugin('mediawiki')) {
-	die ("Project doesn't use the Mediawiki plugin\n") ;
-}
-
-
-define( "MEDIAWIKI", true );
-require_once $gfwww.'plugins/mediawiki/LocalSettings.php' ;
-
-$src_path = forge_get_config('src_path', 'mediawiki');
-$mwscript = $src_path . '/maintenance/'.$mwscript ;
-
-array_unshift ($argv, $mwscript, '--conf', $fusionforge_basedir . '/plugins/mediawiki/www/LocalSettings.php') ;
-
-while (@ob_end_flush());
-
-require_once $mwscript ;
-
-?>

Deleted: trunk/src/plugins/moinmoin/common/MediaWikiPlugin.class.php
===================================================================
--- trunk/src/plugins/moinmoin/common/MediaWikiPlugin.class.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/common/MediaWikiPlugin.class.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,371 +0,0 @@
-<?php
-
-/**
- * MediaWikiPlugin Class
- *
- *
- * 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.
- */
-
-forge_define_config_item('src_path','mediawiki', "/usr/share/mediawiki");
-
-forge_define_config_item('mwdata_path', 'mediawiki', '$core/data_path/plugins/mediawiki');
-forge_define_config_item('projects_path', 'mediawiki', '$mediawiki/mwdata_path/projects');
-forge_define_config_item('master_path', 'mediawiki', '$mediawiki/mwdata_path/master');
-
-forge_define_config_item('enable_uploads', 'mediawiki', false);
-forge_set_config_item_bool('enable_uploads', 'mediawiki');
-forge_define_config_item('use_frame', 'mediawiki', false);
-forge_set_config_item_bool('use_frame', 'mediawiki');
-
-
-class MediaWikiPlugin extends Plugin {
-	function MediaWikiPlugin () {
-		$this->Plugin() ;
-		$this->name = "mediawiki" ;
-		$this->text = "Mediawiki" ; // To show in the tabs, use...
-		$this->hooks[] = "groupmenu" ;	// To put into the project tabs
-		$this->hooks[] = "groupisactivecheckbox" ; // The "use ..." checkbox in editgroupinfo
-		$this->hooks[] = "groupisactivecheckboxpost" ; //
-		$this->hooks[] = "project_public_area";
-		$this->hooks[] = "role_get";
-		$this->hooks[] = "role_normalize";
-		$this->hooks[] = "role_translate_strings";
-		$this->hooks[] = "role_has_permission";
-		$this->hooks[] = "role_get_setting";
-		$this->hooks[] = "list_roles_by_permission";
-		$this->hooks[] = "project_admin_plugins"; // to show up in the admin page for group
-		$this->hooks[] = "clone_project_from_template" ;
-	}
-
-	function CallHook ($hookname, &$params) {
-		if (isset($params['group_id'])) {
-			$group_id=$params['group_id'];
-		} elseif (isset($params['group'])) {
-			$group_id=$params['group'];
-		} else {
-			$group_id=null;
-		}
-		if ($hookname == "groupmenu") {
-			$project = group_get_object($group_id);
-			if (!$project || !is_object($project)) {
-				return;
-			}
-			if ($project->isError()) {
-				return;
-			}
-			if (!$project->isProject()) {
-				return;
-			}
-			if ( $project->usesPlugin ( $this->name ) ) {
-				$params['TITLES'][]=$this->text;
-				if (forge_get_config('use_frame', 'mediawiki')){
-					$params['DIRS'][]=util_make_url ('/plugins/mediawiki/frame.php?group_id=' . $project->getID()) ; 
-				} else {
-					$params['DIRS'][]=util_make_url('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php');
-				}
-			}
-			(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
-		} elseif ($hookname == "groupisactivecheckbox") {
-			//Check if the group is active
-			// this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
-			$group = group_get_object($group_id);
-			echo "<tr>";
-			echo "<td>";
-			echo ' <input type="checkbox" name="use_mediawikiplugin" value="1" ';
-			// checked or unchecked?
-			if ( $group->usesPlugin ( $this->name ) ) {
-				echo "checked";
-			}
-			echo " /><br/>";
-			echo "</td>";
-			echo "<td>";
-			echo "<strong>Use ".$this->text." Plugin</strong>";
-			echo "</td>";
-			echo "</tr>";
-		} elseif ($hookname == "groupisactivecheckboxpost") {
-			// this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
-			$group = group_get_object($group_id);
-			$use_mediawikiplugin = getStringFromRequest('use_mediawikiplugin');
-			if ( $use_mediawikiplugin == 1 ) {
-				$group->setPluginUse ( $this->name );
-			} else {
-				$group->setPluginUse ( $this->name, false );
-			}
-		} elseif ($hookname == "project_public_area") {
-			$project = group_get_object($group_id);
-			if (!$project || !is_object($project)) {
-				return;
-			}
-			if ($project->isError()) {
-				return;
-			}
-			if (!$project->isProject()) {
-				return;
-			}
-			if ( $project->usesPlugin ( $this->name ) ) {
-				echo '<div class="public-area-box">';
-				print '<a href="'. util_make_url ('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php').'">';
-				print html_abs_image(util_make_url ('/plugins/mediawiki/wiki/'.$project->getUnixName().'/skins/fusionforge/wiki.png'),'20','20',array('alt'=>'Mediawiki'));
-				print ' Mediawiki';
-				print '</a>';
-				echo '</div>';
-			}
-		} elseif ($hookname == "role_get") {
-			$role =& $params['role'] ;
-
-			// Read access
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_read') ;
-			$right->SetAllowedValues (array ('0', '1')) ;
-			$right->SetDefaultValues (array ('Admin' => '1',
-							 'Senior Developer' => '1',
-							 'Junior Developer' => '1',
-							 'Doc Writer' => '1',
-							 'Support Tech' => '1')) ;
-			
-			// Edit privileges
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_edit') ;
-			$right->SetAllowedValues (array ('0', '1', '2', '3')) ;
-			$right->SetDefaultValues (array ('Admin' => '3',
-							 'Senior Developer' => '2',
-							 'Junior Developer' => '1',
-							 'Doc Writer' => '3',
-							 'Support Tech' => '0')) ;
-			
-			// File upload privileges
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_upload') ;
-			$right->SetAllowedValues (array ('0', '1', '2')) ;
-			$right->SetDefaultValues (array ('Admin' => '2',
-							 'Senior Developer' => '2',
-							 'Junior Developer' => '1',
-							 'Doc Writer' => '2',
-							 'Support Tech' => '0')) ;
-			
-			// Administrative tasks
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_admin') ;
-			$right->SetAllowedValues (array ('0', '1')) ;
-			$right->SetDefaultValues (array ('Admin' => '1',
-							 'Senior Developer' => '0',
-							 'Junior Developer' => '0',
-							 'Doc Writer' => '0',
-							 'Support Tech' => '0')) ;
-			
-		} elseif ($hookname == "role_normalize") {
-			$role =& $params['role'] ;
-			$new_sa =& $params['new_sa'] ;
-			$new_pa =& $params['new_pa'] ;
-
-			if (USE_PFO_RBAC) {
-				$projects = $role->getLinkedProjects() ;		
-				foreach ($projects as $p) {
-					$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_read', $p->getID()) ;
-					$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_edit', $p->getID()) ;
-					$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_upload', $p->getID()) ;
-					$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_admin', $p->getID()) ;
-				}
-			} else {
-				$role->normalizeDataForSection ($new_sa, 'plugin_mediawiki_read') ;
-				$role->normalizeDataForSection ($new_sa, 'plugin_mediawiki_edit') ;
-				$role->normalizeDataForSection ($new_sa, 'plugin_mediawiki_upload') ;
-				$role->normalizeDataForSection ($new_sa, 'plugin_mediawiki_admin') ;
-			}
-		} elseif ($hookname == "role_translate_strings") {
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_read') ;
-			$right->setDescription (_('Mediawiki read access')) ;
-			$right->setValueDescriptions (array ('0' => _('No reading'),
-							     '1' => _('Read access'))) ;
-
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_edit') ;
-			$right->setDescription (_('Mediawiki write access')) ;
-			$right->setValueDescriptions (array ('0' => _('No editing'),
-							     '1' => _('Edit existing pages only'), 
-							     '2' => _('Edit and create pages'), 
-							     '3' => _('Edit, create, move, delete pages'))) ;
-
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_upload') ;
-			$right->setDescription (_('Mediawiki file upload')) ;
-			$right->setValueDescriptions (array ('0' => _('No uploading'),
-							     '1' => _('Upload permitted'), 
-							     '2' => _('Upload and re-upload'))) ;
-
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_admin') ;
-			$right->setDescription (_('Mediawiki administrative tasks')) ;
-			$right->setValueDescriptions (array ('0' => _('No administrative access'),
-							     '1' => _('Edit interface, import XML dumps'))) ;
-		} elseif ($hookname == "role_get_setting") {
-			$role = $params['role'] ;
-			$reference = $params['reference'] ;
-			$value = $params['value'] ;
-
-			switch ($params['section']) {
-			case 'plugin_mediawiki_read':
-				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 1 ;
-				} else {
-					$params['result'] =  $value ;
-				}
-				break ;
-			case 'plugin_mediawiki_edit':
-				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 3 ;
-				} else {
-					$params['result'] =  $value ;
-				}
-				break ;
-			case 'plugin_mediawiki_upload':
-				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 2 ;
-				} else {
-					$params['result'] =  $value ;
-				}
-				break ;
-			case 'plugin_mediawiki_admin':
-				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 1 ;
-				} else {
-					$params['result'] =  $value ;
-				}
-				break ;
-			}
-		} elseif ($hookname == "role_has_permission") {
-			$value = $params['value'];
-			switch ($params['section']) {
-			case 'plugin_mediawiki_read':
-				switch ($params['action']) {
-				case 'read':
-				default:
-					$params['result'] |= ($value >= 1) ;
-					break ;
-				}
-				break ;
-			case 'plugin_mediawiki_edit':
-				switch ($params['action']) {
-				case 'editexisting':
-					$params['result'] |= ($value >= 1) ;
-					break ;
-				case 'editnew':
-					$params['result'] |= ($value >= 2) ;
-					break ;
-				case 'editmove':
-					$params['result'] |= ($value >= 3) ;
-					break ;
-				}
-				break ;
-			case 'plugin_mediawiki_upload':
-				switch ($params['action']) {
-				case 'upload':
-					$params['result'] |= ($value >= 1) ;
-					break ;
-				case 'reupload':
-					$params['result'] |= ($value >= 2) ;
-					break ;
-				}
-				break ;
-			case 'plugin_mediawiki_admin':
-				switch ($params['action']) {
-				case 'admin':
-				default:
-					$params['result'] |= ($value >= 1) ;
-					break ;
-				}
-				break ;
-			}
-		} elseif ($hookname == "list_roles_by_permission") {
-			switch ($params['section']) {
-			case 'plugin_mediawiki_read':
-				switch ($params['action']) {
-				case 'read':
-				default:
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
-				}
-				break ;
-			case 'plugin_mediawiki_edit':
-				switch ($params['action']) {
-				case 'editexisting':
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
-				case 'editnew':
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 2') ;
-					break ;
-				case 'editmove':
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 3') ;
-					break ;
-				}
-				break ;
-			case 'plugin_mediawiki_upload':
-				switch ($params['action']) {
-				case 'upload':
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
-				case 'reupload':
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 2') ;
-					break ;
-				}
-				break ;
-			case 'plugin_mediawiki_admin':
-				switch ($params['action']) {
-				case 'admin':
-				default:
-					$params['qpa'] = db_construct_qpa ($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
-				}
-				break ;
-			}
-		} else if ($hookname == "project_admin_plugins") {
-			$group_id = $params['group_id'];
-			$group = group_get_object($group_id);
-			if ($group->usesPlugin($this->name))
-				echo util_make_link(
-				    "/plugins/mediawiki/plugin_admin.php?group_id=" .
-				    $group->getID(), _("MediaWiki Plugin admin")) .
-				    "<br />";
-		} elseif ($hookname == "clone_project_from_template") {
-			$template = $params['template'] ;
-			$project = $params['project'] ;
-			$id_mappings = $params['id_mappings'] ;
-			
-			$sections = array ('plugin_mediawiki_read', 'plugin_mediawiki_edit', 'plugin_mediawiki_upload', 'plugin_mediawiki_admin') ;
-
-			foreach ($template->getRoles() as $oldrole) {
-				$newrole = RBACEngine::getInstance()->getRoleById ($id_mappings['role'][$oldrole->getID()]) ;
-				$oldsettings = $oldrole->getSettingsForProject ($template) ;
-				
-				foreach ($sections as $section) {
-					if (isset ($oldsettings[$section][$template->getID()])) {
-						$newrole->setSetting ($section, $project->getID(), $oldsettings[$section][$template->getID()]) ;
-					}
-				}
-			}
-		}
-	}
-  }
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-?>

Copied: trunk/src/plugins/moinmoin/common/MoinMoinPlugin.class.php (from rev 14629, trunk/src/plugins/moinmoin/common/MediaWikiPlugin.class.php)
===================================================================
--- trunk/src/plugins/moinmoin/common/MoinMoinPlugin.class.php	                        (rev 0)
+++ trunk/src/plugins/moinmoin/common/MoinMoinPlugin.class.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -0,0 +1,133 @@
+<?php
+
+/**
+ * MoinMoinPlugin Class
+ *
+ *
+ * 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.
+ */
+
+forge_define_config_item('src_path','moinmoin', "/usr/share/moin");
+forge_define_config_item('wiki_data_path','moinmoin', '$core/data_path/plugins/moinmoin/wikidata');
+forge_define_config_item('use_frame', 'moinmoin', false);
+forge_set_config_item_bool('use_frame', 'moinmoin');
+
+class MoinMoinPlugin extends Plugin {
+	function MoinMoinPlugin () {
+		$this->Plugin() ;
+		$this->name = "moinmoin" ;
+		$this->text = "MoinMoin" ; // To show in the tabs, use...
+		$this->hooks[] = "groupmenu" ;	// To put into the project tabs
+		$this->hooks[] = "groupisactivecheckbox" ; // The "use ..." checkbox in editgroupinfo
+		$this->hooks[] = "groupisactivecheckboxpost" ; //
+		$this->hooks[] = "project_public_area";
+		$this->hooks[] = "role_get";
+		$this->hooks[] = "role_normalize";
+		$this->hooks[] = "role_translate_strings";
+		$this->hooks[] = "role_has_permission";
+		$this->hooks[] = "role_get_setting";
+		$this->hooks[] = "list_roles_by_permission";
+		$this->hooks[] = "project_admin_plugins"; // to show up in the admin page for group
+		$this->hooks[] = "clone_project_from_template" ;
+	}
+
+	function getWikiUrl ($project) {
+		if (forge_get_config('use_frame', 'moinmoin')){
+			return util_make_url ('/plugins/moinmoin/frame.php?group_id=' . $project->getID()) ; 
+		} else {
+			return util_make_url('/plugins/moinmoin/'.$project->getUnixName().'/FrontPage');
+		}
+	}
+
+	function CallHook ($hookname, &$params) {
+		if (isset($params['group_id'])) {
+			$group_id=$params['group_id'];
+		} elseif (isset($params['group'])) {
+			$group_id=$params['group'];
+		} else {
+			$group_id=null;
+		}
+		if ($hookname == "groupmenu") {
+			$project = group_get_object($group_id);
+			if (!$project || !is_object($project)) {
+				return;
+			}
+			if ($project->isError()) {
+				return;
+			}
+			if (!$project->isProject()) {
+				return;
+			}
+			if ( $project->usesPlugin ( $this->name ) ) {
+				$params['TITLES'][]=$this->text;
+				$params['DIRS'][]=$this->getWikiUrl($project);
+			}
+			(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
+		} elseif ($hookname == "groupisactivecheckbox") {
+			//Check if the group is active
+			// this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
+			$group = group_get_object($group_id);
+			echo "<tr>";
+			echo "<td>";
+			echo ' <input type="checkbox" name="use_moinmoinplugin" value="1" ';
+			// checked or unchecked?
+			if ( $group->usesPlugin ( $this->name ) ) {
+				echo "checked";
+			}
+			echo " /><br/>";
+			echo "</td>";
+			echo "<td>";
+			echo "<strong>Use ".$this->text." Plugin</strong>";
+			echo "</td>";
+			echo "</tr>";
+		} elseif ($hookname == "groupisactivecheckboxpost") {
+			// this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
+			$group = group_get_object($group_id);
+			$use_moinmoinplugin = getStringFromRequest('use_moinmoinplugin');
+			if ( $use_moinmoinplugin == 1 ) {
+				$group->setPluginUse ( $this->name );
+			} else {
+				$group->setPluginUse ( $this->name, false );
+			}
+		} elseif ($hookname == "project_public_area") {
+			$project = group_get_object($group_id);
+			if (!$project || !is_object($project)) {
+				return;
+			}
+			if ($project->isError()) {
+				return;
+			}
+			if (!$project->isProject()) {
+				return;
+			}
+			if ( $project->usesPlugin ( $this->name ) ) {
+				echo '<div class="public-area-box">';
+				print '<a href="'. $this->getWikiUrl($project).'">';
+				print 'MoinMoin';
+				print '</a>';
+				echo '</div>';
+			}
+		}
+	}
+  }
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Deleted: trunk/src/plugins/moinmoin/common/mediawiki-init.php
===================================================================
--- trunk/src/plugins/moinmoin/common/mediawiki-init.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/common/mediawiki-init.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,34 +0,0 @@
-<?php
-
-/**
- *
- * 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.
- */
-
-global $gfplugins;
-require_once $gfplugins.'mediawiki/common/MediaWikiPlugin.class.php' ;
-
-$MediaWikiPluginObject = new MediaWikiPlugin ;
-
-register_plugin ($MediaWikiPluginObject) ;
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
-
-?>

Copied: trunk/src/plugins/moinmoin/common/moinmoin-init.php (from rev 14629, trunk/src/plugins/moinmoin/common/mediawiki-init.php)
===================================================================
--- trunk/src/plugins/moinmoin/common/moinmoin-init.php	                        (rev 0)
+++ trunk/src/plugins/moinmoin/common/moinmoin-init.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * 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.
+ */
+
+global $gfplugins;
+require_once $gfplugins.'moinmoin/common/MoinMoinPlugin.class.php' ;
+
+$MoinMoinPluginObject = new MoinMoinPlugin ;
+
+register_plugin ($MoinMoinPluginObject) ;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Deleted: trunk/src/plugins/moinmoin/cronjobs/create-imagedirs.php
===================================================================
--- trunk/src/plugins/moinmoin/cronjobs/create-imagedirs.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/cronjobs/create-imagedirs.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,77 +0,0 @@
-#! /usr/bin/php
-<?php
-/* 
- * Copyright (C) 2010  Olaf Lenz
- *
- * 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.
- */
-
-  /** This script will automatically create the image upload
-   directories for all mediawiki instances.
-   
-   It is intended to be started in a cronjob with root permissions.
-   */
-
-require_once dirname(__FILE__) . '/../../../www/env.inc.php';
-require_once $gfcommon.'include/pre.php';
-require_once $gfcommon.'include/cron_utils.php';
-
-if (forge_get_config('enable_uploads', 'mediawiki')) {
-	$upload_dir_basename = "images";
-	$projects_path = forge_get_config('projects_path', 'mediawiki');
-
-# Owner of files - apache
-	$dir_owner = forge_get_config('apache_user');
-	$dir_group = forge_get_config('apache_group');
-
-# Get all projects that use the mediawiki plugin
-	$project_res = db_query_params ("SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = $1;", array("mediawiki"));
-	if (!$project_res) {
-		$err =  "Error: Database Query Failed: ".db_error();
-		cron_debug($err);
-		cron_entry(23,$err);
-		exit;
-	}
-
-# Loop over all projects that use the plugin
-	while ( $row = db_fetch_array($project_res) ) {
-		$project = $row['unix_group_name'];
-		$project_dir = "$projects_path/$project";
-		cron_debug("Checking $project...");
-
-		// Create the image directory if necessary
-		$upload_dir = "$project_dir/$upload_dir_basename";
-		if (!is_dir($upload_dir)) {
-			cron_debug("  Creating upload dir $upload_dir.");
-			mkdir($upload_dir, 0700);
-		} else {
-			cron_debug("  Upload dir $upload_dir exists.");
-		}
-		cron_debug("  Changing owner ($dir_owner), group ($dir_group) and permission (0775) of upload dir $upload_dir.");
-		chown($upload_dir, $dir_owner);
-		chgrp($upload_dir, $dir_group);
-		chmod($upload_dir, 0775);
-	}
-} else {
-	cron_debug("Mediawiki uploads not enabled, quitting create-imagedirs.php!");
-}
-  // Local Variables:
-  // mode: php
-  // c-file-style: "bsd"
-  // End:
-
-?>

Modified: trunk/src/plugins/moinmoin/cronjobs/create-wikis.php
===================================================================
--- trunk/src/plugins/moinmoin/cronjobs/create-wikis.php	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/cronjobs/create-wikis.php	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,7 +1,8 @@
 #! /usr/bin/php
 <?php
 /* 
- * Copyright (C) 2010  Olaf Lenz
+ * Copyright 2010, Olaf Lenz
+ * Copyright 2011, Roland Mas
  *
  * This file is part of FusionForge.
  *
@@ -20,25 +21,22 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-  /** This script will automatically create mediawiki instances for
-   projects that do not yet have it.
+  /** This script will automatically create MoinMoin instances for
+   projects that do not yet have them.
    
    It is intended to be started in a cronjob.
    */
 
-# TODO: How to use cronjob history?
-# Required config variables:
-#   src_path: the directory where the mediawiki sources are installed
-
-require_once dirname(__FILE__) . '/../../../www/env.inc.php';
+require_once (dirname(__FILE__) . '/../../../www/env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfcommon.'include/cron_utils.php';
 
-$src_path = forge_get_config('src_path', 'mediawiki');
-$master_path = forge_get_config('master_path', 'mediawiki');
+$data_path = forge_get_config('data_path');
+$src_path = forge_get_config('src_path', 'moinmoin');
+$wikidata = forge_get_config('wiki_data_path', 'moinmoin');
 
-# Get all projects that use the mediawiki plugin
-$project_res = db_query_params ("SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = $1;", array("mediawiki"));
+// Get all projects that use the mediawiki plugin
+$project_res = db_query_params ("SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = $1;", array("moinmoin"));
 if (!$project_res) {
 	$err =  "Error: Database Query Failed: ".db_error();
 	cron_debug($err);
@@ -46,101 +44,42 @@
 	exit;
 }
 
-# Loop over all projects that use the plugin
+$need_reload = false;
+
+// Loop over all projects that use the plugin
 while ( $row = db_fetch_array($project_res) ) {
 	$project = $row['unix_group_name'];
-	$project_dir = forge_get_config('projects_path', 'mediawiki') 
-		. "/$project";
+	$project_dir = "$wikidata/$project";
 	cron_debug("Checking $project...");
 
 	// Create the project directory if necessary
-	if (is_dir($project_dir)) {
-		cron_debug("  Project dir $project_dir exists, so I assumen the project already exists.");
-	} else {
+	if (!is_dir($project_dir)) {
 		cron_debug("  Creating project dir $project_dir.");
-		mkdir($project_dir, 0775, true);
+		mkdir($project_dir, 0755, true);
+		system("cp -r /usr/share/moin/data /usr/share/moin/underlay $project_dir/");
+		system("chown -R gforge:gforge $project_dir");
+		$f = fopen ("$wikidata/$project.py","w");
+		fwrite ($f, "from farmconfig import FarmConfig
+class Config(FarmConfig):
+    sitename = u'$project'
+    interwikiname = u'$project'
+    page_front_page = u'FrontPage'
 
-		// Create the DB
-		$schema = "plugin_mediawiki_$project";
-		// Sanitize schema name
-		$schema = strtr($schema, "-", "_");
-
-		db_begin();
-
-		cron_debug("  Creating schema $schema.");
-		$res = db_query_params("CREATE SCHEMA $schema", array());
-		if (!$res) {
-			$err =  "Error: Schema Creation Failed: " . 
-				db_error();
-			cron_debug($err);
-			cron_entry(23,$err);
-			db_rollback();
-			exit;
-		}
-
-		cron_debug("  Creating mediawiki database.");
-		$table_file = "$src_path/maintenance/postgres/tables.sql";
-		if (!file_exists($table_file)) {
-			$err =  "Error: Couldn't find Mediawiki Database Creation File $table_file!";
-			cron_debug($err);
-			cron_entry(23,$err);
-			db_rollback();
-			exit;
-		}
-			
-		$res = db_query_params("SET search_path=$schema", array());
-		if (!$res) {
-			$err =  "Error: DB Query Failed: " . 
-				db_error();
-			cron_debug($err);
-			cron_entry(23,$err);
-			db_rollback();
-			exit;
-		}
-
-		$creation_query = file_get_contents($table_file);
-		$res = db_query_from_file($table_file);
-		if (!$res) {
-			$err =  "Error: Mediawiki Database Creation Failed: " . 
-				db_error();
-			cron_debug($err);
-			cron_entry(23,$err);
-			db_rollback();
-			exit;
-		}
-
-		$res = db_query_params("CREATE TEXT SEARCH CONFIGURATION $schema.default ( COPY = pg_catalog.english )", array());
-		if (!$res) {
-			$err =  "Error: DB Query Failed: " . 
-				db_error();
-			cron_debug($err);
-			cron_entry(23,$err);
-			db_rollback();
-			exit;
-		}
-		
-		if (!db_commit()) {
-			$err =  "Error: DB Commit Failed: " . 
-				db_error();
-			cron_debug($err);
-			cron_entry(23,$err);
-			exit;
-		}
-
-		$mwwrapper = forge_get_config('source_path')."/plugins/mediawiki/bin/mw-wrapper.php" ;
-		$dumpfile = forge_get_config('config_path')."/mediawiki/initial-content.xml" ;
-		
-		if (file_exists ($dumpfile)) {
-			system ("$mwwrapper $project importDump.php $dumpfile") ;
-			system ("$mwwrapper $project rebuildrecentchanges.php") ;
-		}
+    data_dir = '$project_dir'
+");
+		fclose($f);
+		       
+		$need_reload = true;
 	} 
 }
 
+if ($need_reload) {
+	system("invoke-rc.d apache2 reload");
+}
 
-  // Local Variables:
-  // mode: php
-  // c-file-style: "bsd"
-  // End:
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
 
 ?>

Modified: trunk/src/plugins/moinmoin/etc/wikiconfig.py
===================================================================
--- trunk/src/plugins/moinmoin/etc/wikiconfig.py	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/etc/wikiconfig.py	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,9 +1,14 @@
 # -*- coding: iso-8859-1 mode:python -*-
 
 from MoinMoin.config import multiconfig
-import fusionforge_session
-class Config(multiconfig.DefaultConfig):
+import fusionforge
 
+import sys
+sys.path.insert(0, '/etc/moin')
+import farmconfig
+
+class Config(farmconfig.FarmConfig):
+
     # basic options (you normally need to change these)
     sitename = u'ForgeWiki' # [Unicode]
     interwikiname = u'ForgeWiki' # [Unicode]
@@ -16,10 +21,17 @@
     # b) if wiki content is maintained in many languages
     page_front_page = u"FrontPage"
 
-    data_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/data'
-    data_underlay_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/underlay'
+    # data_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/data'
+    # data_underlay_dir = '/var/lib/gforge/plugins/moinmoin/wikidata/underlay'
 
-    ffsa = fusionforge_session.FusionForgeSessionAuth()
+    ffsa = fusionforge.FusionForgeSessionAuth()
 
     auth = [ffsa]
     superuser = ffsa.get_super_users()
+
+    ff_link = fusionforge.FusionForgeLink()
+    ff_host = ff_link.get_config('web_host')
+    farmconfig.wikis = []
+    for project in ff_link.get_projects():
+        farmconfig.wikis.append(("project", "^https?://"+ff_host+"/plugins/moinmoin/"+project+"/.*$"),)
+

Copied: trunk/src/plugins/moinmoin/lib/fusionforge.py (from rev 14629, trunk/src/plugins/moinmoin/lib/fusionforge_session.py)
===================================================================
--- trunk/src/plugins/moinmoin/lib/fusionforge.py	                        (rev 0)
+++ trunk/src/plugins/moinmoin/lib/fusionforge.py	2011-10-14 16:03:45 UTC (rev 14630)
@@ -0,0 +1,115 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - FusionForge session cookie authentication
+
+    @copyright: 2005 MoinMoin:AlexanderSchremmer (Thanks to Spreadshirt)
+    @copyright: 2011 Roland Mas
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import urllib
+import re
+import hashlib
+import base64
+import subprocess
+import psycopg2
+from MoinMoin import user
+from MoinMoin.auth import _PHPsessionParser, BaseAuth
+
+class FusionForgeLink():
+    def get_config(self, varname, secname='core'):
+        return subprocess.Popen(["/usr/share/gforge/bin/forge_get_config", varname, secname], stdout = subprocess.PIPE).communicate()[0].rstrip('\n')
+
+    def __init__(self, cookies=['session_ser'], autocreate=True):
+        self.database_host = self.get_config('database_host')
+        self.database_name = self.get_config('database_name')
+        self.database_user = self.get_config('database_user')
+        self.database_port = self.get_config('database_port')
+        self.database_password = self.get_config('database_password')
+
+        if (self.database_host != ''):
+            self.conn = psycopg2.connect(database=self.database_name,
+                                         user=self.database_user,
+                                         port=self.database_port,
+                                         password=self.database_password,
+                                         host=self.database_host)
+        else:
+            self.conn = psycopg2.connect(database=self.database_name,
+                                         user=self.database_user,
+                                         port=self.database_port,
+                                         password=self.database_password)
+
+    def get_connection(self):
+        return self.conn
+
+    def get_projects(self):
+        cur = self.conn.cursor()
+        cur.execute("SELECT g.unix_group_name from groups g, group_plugin gp, plugins p where g.group_id = gp.group_id and gp.plugin_id = p.plugin_id and p.plugin_name = 'moinmoin'")
+        projects = []
+        for record in cur:
+            projects.append(record[0])
+        return projects
+
+class FusionForgeSessionAuth(BaseAuth):
+    """ FusionForge session cookie authentication """
+
+    name = 'fusionforge_session'
+
+    def __init__(self, cookies=['session_ser'], autocreate=True):
+        """ @param cookie: Names of the cookies to parse.
+        """
+        BaseAuth.__init__(self)
+        self.cookies = cookies
+        self.autocreate = autocreate
+
+        self.fflink = FusionForgeLink()
+        self.conn = self.fflink.get_connection()
+        self.session_key = self.fflink.get_config('session_key')
+
+    def get_super_users(self):
+        cur = self.conn.cursor()
+        cur.execute("SELECT distinct(u.user_name) from users u, pfo_user_role pur, pfo_role pr, pfo_role_setting prs WHERE u.user_id = pur.user_id AND pur.role_id = pr.role_id AND pr.role_id = prs.role_id AND prs.section_name='forge_admin'")
+        admins = []
+        for record in cur:
+            admins.append(record[0])
+        return admins
+
+    def request(self, request, user_obj, **kw):
+        cookies = kw.get('cookie')
+        if cookies is None or cookies == {}:
+            return user_obj, False
+
+        for cookiename in cookies:
+            if cookiename not in self.cookies:
+                continue
+            cookievalue = urllib.unquote(cookies[cookiename]).decode('iso-8859-1')
+
+            m = re.search('(.*)-\*-(.*)', cookievalue)
+            if m is None:
+                continue
+            (sserial, shash) = m.group(1, 2)
+
+            sdata = base64.b64decode(sserial)
+            if hashlib.md5(sdata + self.session_key).hexdigest() != shash:
+                continue
+            
+            m = re.search('(.*)-\*-(.*)-\*-(.*)-\*-(.*)', sdata)
+            if m is None:
+                continue
+            (user_id, time, ip, user_agent) = m.group(1, 2, 3, 4)
+
+            cur = self.conn.cursor()
+            cur.execute("SELECT user_name, realname FROM users WHERE user_id=%s", [user_id])
+            (loginname, realname) = cur.fetchone()
+            cur.close()
+
+            # MoinMoin doesn't enforce unicity of realnames
+            u = user.User(request, name=loginname, auth_username=loginname,
+                          auth_method=self.name)
+
+            if u and self.autocreate:
+                u.create_or_update(True)
+            if u and u.valid:
+                return u, True # True to get other methods called, too
+            return user_obj, False # continue with next method in auth list
+

Deleted: trunk/src/plugins/moinmoin/lib/fusionforge_session.py
===================================================================
--- trunk/src/plugins/moinmoin/lib/fusionforge_session.py	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/lib/fusionforge_session.py	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,99 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - FusionForge session cookie authentication
-
-    @copyright: 2005 MoinMoin:AlexanderSchremmer (Thanks to Spreadshirt)
-    @copyright: 2011 Roland Mas
-    @license: GNU GPL, see COPYING for details.
-"""
-
-import urllib
-import re
-import hashlib
-import base64
-import subprocess
-import psycopg2
-from MoinMoin import user
-from MoinMoin.auth import _PHPsessionParser, BaseAuth
-
-class FusionForgeSessionAuth(BaseAuth):
-    """ FusionForge session cookie authentication """
-
-    name = 'fusionforge_session'
-
-    def __getconfig(self, varname):
-        return subprocess.Popen(["/usr/share/gforge/bin/forge_get_config", varname], stdout = subprocess.PIPE).communicate()[0].rstrip('\n')
-
-    def __init__(self, cookies=['session_ser'], autocreate=True):
-        """ @param cookie: Names of the cookies to parse.
-        """
-        BaseAuth.__init__(self)
-        self.cookies = cookies
-        self.autocreate = autocreate
-
-        self.database_host = self.__getconfig('database_host')
-        self.database_name = self.__getconfig('database_name')
-        self.database_user = self.__getconfig('database_user')
-        self.database_port = self.__getconfig('database_port')
-        self.database_password = self.__getconfig('database_password')
-        self.session_key = self.__getconfig('session_key')
-
-        if (self.database_host != ''):
-            self.conn = psycopg2.connect(database=self.database_name,
-                                         user=self.database_user,
-                                         port=self.database_port,
-                                         password=self.database_password,
-                                         host=self.database_host)
-        else:
-            self.conn = psycopg2.connect(database=self.database_name,
-                                         user=self.database_user,
-                                         port=self.database_port,
-                                         password=self.database_password)
-
-    def get_super_users(self):
-        cur = self.conn.cursor()
-        cur.execute("SELECT distinct(u.user_name) from users u, pfo_user_role pur, pfo_role pr, pfo_role_setting prs WHERE u.user_id = pur.user_id AND pur.role_id = pr.role_id AND pr.role_id = prs.role_id AND prs.section_name='forge_admin'")
-        admins = []
-        for record in cur:
-            admins.append(record[0])
-        return admins
-
-    def request(self, request, user_obj, **kw):
-        cookies = kw.get('cookie')
-        if cookies is None or cookies == {}:
-            return user_obj, False
-
-        for cookiename in cookies:
-            if cookiename not in self.cookies:
-                continue
-            cookievalue = urllib.unquote(cookies[cookiename]).decode('iso-8859-1')
-
-            m = re.search('(.*)-\*-(.*)', cookievalue)
-            if m is None:
-                continue
-            (sserial, shash) = m.group(1, 2)
-
-            sdata = base64.b64decode(sserial)
-            if hashlib.md5(sdata + self.session_key).hexdigest() != shash:
-                continue
-            
-            m = re.search('(.*)-\*-(.*)-\*-(.*)-\*-(.*)', sdata)
-            if m is None:
-                continue
-            (user_id, time, ip, user_agent) = m.group(1, 2, 3, 4)
-
-            cur = self.conn.cursor()
-            cur.execute("SELECT user_name, realname FROM users WHERE user_id=%s", [user_id])
-            (loginname, realname) = cur.fetchone()
-            cur.close()
-
-            # MoinMoin doesn't enforce unicity of realnames
-            u = user.User(request, name=loginname, auth_username=loginname,
-                          auth_method=self.name)
-
-            if u and self.autocreate:
-                u.create_or_update(True)
-            if u and u.valid:
-                return u, True # True to get other methods called, too
-            return user_obj, False # continue with next method in auth list
-

Deleted: trunk/src/plugins/moinmoin/packaging/cron.d/plugin-mediawiki
===================================================================
--- trunk/src/plugins/moinmoin/packaging/cron.d/plugin-mediawiki	2011-10-14 16:03:19 UTC (rev 14629)
+++ trunk/src/plugins/moinmoin/packaging/cron.d/plugin-mediawiki	2011-10-14 16:03:45 UTC (rev 14630)
@@ -1,17 +0,0 @@
-FFDIR=/usr/share/@OLDPACKAGE@
-MWCRON=/usr/share/@OLDPACKAGE@/plugins/mediawiki/cronjobs
-FFUSER=gforge
-
-# You may need to change the pathname to php CLI (command line interface)
-PHP="/usr/bin/php -q -d include_path=.:/etc/gforge:/usr/share/gforge:/usr/share/gforge/www/include:/usr/share/gforge/plugins"
-
-# Don't mail command output to anyone.
-MAILTO=""
-
-#
-# Regular cron jobs for the plugin-mediawiki package
-#
-
-# Create new mediawikis four times an hour
-0,15,30,45 * * * * root [ -x $MWCRON/create-wikis.php ] && $PHP $MWCRON/create-wikis.php
-1,16,31,46 * * * * root [ -x $MWCRON/create-imagedirs.php ] && $PHP $MWCRON/create-imagedirs.php

Added: trunk/src/plugins/moinmoin/packaging/cron.d/plugin-moinmoin
===================================================================
--- trunk/src/plugins/moinmoin/packaging/cron.d/plugin-moinmoin	                        (rev 0)
+++ trunk/src/plugins/moinmoin/packaging/cron.d/plugin-moinmoin	2011-10-14 16:03:45 UTC (rev 14630)
@@ -0,0 +1,16 @@
+FFDIR=/usr/share/@OLDPACKAGE@
+MWCRON=/usr/share/@OLDPACKAGE@/plugins/moinmoin/cronjobs
+FFUSER=gforge
+
+# You may need to change the pathname to php CLI (command line interface)
+PHP="/usr/bin/php -q -d include_path=.:/etc/gforge:/usr/share/gforge:/usr/share/gforge/www/include:/usr/share/gforge/plugins"
+
+# Don't mail command output to anyone.
+MAILTO=""
+
+#
+# Regular cron jobs for the plugin-moinmoin package
+#
+
+# Create new wikis four times an hour
+0,15,30,45 * * * * root [ -x $MWCRON/create-wikis.php ] && $PHP $MWCRON/create-wikis.php




More information about the Fusionforge-commits mailing list