[Fusionforge-commits] r9152 - in trunk/gforge: common/include etc/httpd.d packaging/links plugins/mediawiki plugins/mediawiki/bin plugins/mediawiki/cronjobs plugins/mediawiki/etc plugins/mediawiki/etc/cron.d plugins/mediawiki/etc/plugins/mediawiki plugins/mediawiki/scripts plugins/mediawiki/www www/admin

Olaf Lenz olenz at libremir.placard.fr.eu.org
Fri Mar 19 18:37:23 CET 2010


Author: olenz
Date: 2010-03-19 18:37:22 +0100 (Fri, 19 Mar 2010)
New Revision: 9152

Added:
   trunk/gforge/plugins/mediawiki/bin/drop-wiki.php
   trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php
   trunk/gforge/plugins/mediawiki/etc/cron.d/
   trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.php
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/config.php
   trunk/gforge/plugins/mediawiki/scripts/
   trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php
Removed:
   trunk/gforge/packaging/links/plugin-mediawiki
   trunk/gforge/plugins/mediawiki/bin/drop-wiki.sh
   trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh
   trunk/gforge/plugins/mediawiki/www/LocalSettings.php
Modified:
   trunk/gforge/common/include/PluginManager.class.php
   trunk/gforge/etc/httpd.d/06maindirhttp
   trunk/gforge/etc/httpd.d/07maindirhttp.vhost.ssl
   trunk/gforge/www/admin/pluginman.php
Log:
Updated mediawiki plugin:
* made it configurable
* created init script that will be called from pluginman

Modified: trunk/gforge/common/include/PluginManager.class.php
===================================================================
--- trunk/gforge/common/include/PluginManager.class.php	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/common/include/PluginManager.class.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -99,7 +99,7 @@
 		return $res;
 	}
 
-	function desactivate($pluginname) {
+	function deactivate($pluginname) {
 		$res = db_query_params('DELETE FROM plugins WHERE plugin_name = $1', array($pluginname));
 
 		foreach ($this->plugins_data as $i => $n) {

Modified: trunk/gforge/etc/httpd.d/06maindirhttp
===================================================================
--- trunk/gforge/etc/httpd.d/06maindirhttp	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/etc/httpd.d/06maindirhttp	2010-03-19 17:37:22 UTC (rev 9152)
@@ -44,8 +44,7 @@
 
 	RedirectMatch 301 ^({sys_urlprefix}plugins/mediawiki/wiki/[-a-zA-Z0-9_]*)/*$ $1/index.php
 	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/[-a-zA-Z0-9_]*/index.php {usr_share_gforge}/www/plugins/mediawiki/index.php
-	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/([-a-zA-Z0-9_]*)/images/(.*) {var_lib_gforge}/plugins/mediawiki/wikidata/$1/images/$2
-	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/([-a-zA-Z0-9_]*)/skins/(.*) /usr/share/mediawiki/skins/$2
+	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/([-a-zA-Z0-9_]*)/images/(.*) {var_lib_gforge}/plugins/mediawiki/projects/$1/images/$2
 
         Alias {sys_urlprefix}anonscm/ {var_lib_gforge}/chroot/scmrepos/
 

Modified: trunk/gforge/etc/httpd.d/07maindirhttp.vhost.ssl
===================================================================
--- trunk/gforge/etc/httpd.d/07maindirhttp.vhost.ssl	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/etc/httpd.d/07maindirhttp.vhost.ssl	2010-03-19 17:37:22 UTC (rev 9152)
@@ -61,8 +61,7 @@
 
 	RedirectMatch 301 ^({sys_urlprefix}plugins/mediawiki/wiki/[-a-zA-Z0-9_]*)/*$ $1/index.php
 	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/[-a-zA-Z0-9_]*/index.php {usr_share_gforge}/www/plugins/mediawiki/index.php
-	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/([-a-zA-Z0-9_]*)/images/(.*) {var_lib_gforge}/plugins/mediawiki/wikidata/$1/images/$2
-	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/([-a-zA-Z0-9_]*)/skins/(.*) /usr/share/mediawiki/skins/$2
+	AliasMatch ^{sys_urlprefix}plugins/mediawiki/wiki/([-a-zA-Z0-9_]*)/images/(.*) {var_lib_gforge}/plugins/mediawiki/projects/$1/images/$2
 
         Alias {sys_urlprefix}anonscm/ {var_lib_gforge}/chroot/scmrepos/
 	Alias {sys_urlprefix} {usr_share_gforge}/www/

Deleted: trunk/gforge/packaging/links/plugin-mediawiki
===================================================================
--- trunk/gforge/packaging/links/plugin-mediawiki	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/packaging/links/plugin-mediawiki	2010-03-19 17:37:22 UTC (rev 9152)
@@ -1,45 +0,0 @@
-/usr/share/mediawiki/skins/@PACKAGE@/loader.php /etc/mediawiki-extensions/extensions-available/GforgeAuth.php
-
-/usr/share/mediawiki/StartProfiler.php /usr/share/gforge/plugins/mediawiki/www/StartProfiler.php
-/usr/share/mediawiki/api.php /usr/share/gforge/plugins/mediawiki/www/api.php
-/usr/share/mediawiki/extensions /usr/share/gforge/plugins/mediawiki/www/extensions
-/usr/share/mediawiki/img_auth.php /usr/share/gforge/plugins/mediawiki/www/img_auth.php
-/usr/share/mediawiki/includes /usr/share/gforge/plugins/mediawiki/www/includes
-/usr/share/mediawiki/index.php /usr/share/gforge/plugins/mediawiki/www/index.php
-/usr/share/mediawiki/languages /usr/share/gforge/plugins/mediawiki/www/languages
-/usr/share/mediawiki/maintenance /usr/share/gforge/plugins/mediawiki/www/maintenance
-/usr/share/mediawiki/opensearch_desc.php /usr/share/gforge/plugins/mediawiki/www/opensearch_desc.php
-/usr/share/mediawiki/profileinfo.php /usr/share/gforge/plugins/mediawiki/www/profileinfo.php
-/usr/share/mediawiki/redirect.php /usr/share/gforge/plugins/mediawiki/www/redirect.php
-/usr/share/mediawiki/thumb.php /usr/share/gforge/plugins/mediawiki/www/thumb.php
-/usr/share/mediawiki/trackback.php /usr/share/gforge/plugins/mediawiki/www/trackback.php
-
-/usr/share/mediawiki/skins/monobook/FF2Fixes.css /usr/share/mediawiki/skins/fusionforge/FF2Fixes.css
-/usr/share/mediawiki/skins/monobook/IE50Fixes.css /usr/share/mediawiki/skins/fusionforge/IE50Fixes.css
-/usr/share/mediawiki/skins/monobook/IE55Fixes.css /usr/share/mediawiki/skins/fusionforge/IE55Fixes.css
-/usr/share/mediawiki/skins/monobook/IE60Fixes.css /usr/share/mediawiki/skins/fusionforge/IE60Fixes.css
-/usr/share/mediawiki/skins/monobook/IE70Fixes.css /usr/share/mediawiki/skins/fusionforge/IE70Fixes.css
-/usr/share/mediawiki/skins/monobook/IEMacFixes.css /usr/share/mediawiki/skins/fusionforge/IEMacFixes.css
-/usr/share/mediawiki/skins/monobook/KHTMLFixes.css /usr/share/mediawiki/skins/fusionforge/KHTMLFixes.css
-/usr/share/mediawiki/skins/monobook/Opera6Fixes.css /usr/share/mediawiki/skins/fusionforge/Opera6Fixes.css
-/usr/share/mediawiki/skins/monobook/Opera7Fixes.css /usr/share/mediawiki/skins/fusionforge/Opera7Fixes.css
-/usr/share/mediawiki/skins/monobook/Opera9Fixes.css /usr/share/mediawiki/skins/fusionforge/Opera9Fixes.css
-/usr/share/mediawiki/skins/monobook/audio.png /usr/share/mediawiki/skins/fusionforge/audio.png
-/usr/share/mediawiki/skins/monobook/bullet.gif /usr/share/mediawiki/skins/fusionforge/bullet.gif
-/usr/share/mediawiki/skins/monobook/discussionitem_icon.gif /usr/share/mediawiki/skins/fusionforge/discussionitem_icon.gif
-/usr/share/mediawiki/skins/monobook/document.png /usr/share/mediawiki/skins/fusionforge/document.png
-/usr/share/mediawiki/skins/monobook/external-rtl.png /usr/share/mediawiki/skins/fusionforge/external-rtl.png
-/usr/share/mediawiki/skins/monobook/external.png /usr/share/mediawiki/skins/fusionforge/external.png
-/usr/share/mediawiki/skins/monobook/file_icon.gif /usr/share/mediawiki/skins/fusionforge/file_icon.gif
-/usr/share/mediawiki/skins/monobook/headbg.jpg /usr/share/mediawiki/skins/fusionforge/headbg.jpg
-/usr/share/mediawiki/skins/monobook/link_icon.gif /usr/share/mediawiki/skins/fusionforge/link_icon.gif
-/usr/share/mediawiki/skins/monobook/lock_icon.gif /usr/share/mediawiki/skins/fusionforge/lock_icon.gif
-/usr/share/mediawiki/skins/monobook/magnify-clip.png /usr/share/mediawiki/skins/fusionforge/magnify-clip.png
-/usr/share/mediawiki/skins/monobook/mail_icon.gif /usr/share/mediawiki/skins/fusionforge/mail_icon.gif
-/usr/share/mediawiki/skins/monobook/news_icon.png /usr/share/mediawiki/skins/fusionforge/news_icon.png
-/usr/share/mediawiki/skins/monobook/required.gif /usr/share/mediawiki/skins/fusionforge/required.gif
-/usr/share/mediawiki/skins/monobook/rtl.css /usr/share/mediawiki/skins/fusionforge/rtl.css
-/usr/share/mediawiki/skins/monobook/user.gif /usr/share/mediawiki/skins/fusionforge/user.gif
-/usr/share/mediawiki/skins/monobook/video.png /usr/share/mediawiki/skins/fusionforge/video.png
-/usr/share/mediawiki/skins/monobook/wiki-indexed.png /usr/share/mediawiki/skins/fusionforge/wiki-indexed.png
-/usr/share/mediawiki/skins/monobook/wiki.png /usr/share/mediawiki/skins/fusionforge/wiki.png

Added: trunk/gforge/plugins/mediawiki/bin/drop-wiki.php
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/drop-wiki.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/bin/drop-wiki.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,64 @@
+#! /usr/bin/php5
+<?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 FusionForge; if not, write to the Free Software
+   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   */
+
+  /** This script will destroy a mediawiki instance of a specific project.     */
+require (dirname(__FILE__) . '/../../env.inc.php');
+require_once ($gfwww . 'include/squal_pre.php');
+
+if (!isset($mediawiki_var_path))
+	$mediawiki_var_path = "$sys_var_path/plugins/mediawiki";
+if (!isset($mediawiki_projects_path))
+	$mediawiki_projects_path = "$mediawiki_var_path/projects";
+
+if ($argc < 2 ) {
+	echo "Usage " . $argv[0] . " <project>\n";
+	exit (0);
+}
+
+array_shift($argv);
+foreach ($argv as $project) {
+  echo "Removing project wiki of $project.\n";
+
+  $project_dir = "$mediawiki_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("DROP SCHEMA $schema CASCADE;");
+  if (!$res) {
+    echo db_error();
+  }
+}
+
+  // Local Variables:
+  // mode: php
+  // c-file-style: "bsd"
+  // End:
+
+?>
+

Deleted: trunk/gforge/plugins/mediawiki/bin/drop-wiki.sh
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/drop-wiki.sh	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/plugins/mediawiki/bin/drop-wiki.sh	2010-03-19 17:37:22 UTC (rev 9152)
@@ -1,18 +0,0 @@
-#! /bin/sh
-
-# Usage: drop-wiki.sh <unix-name>
-
-project=$1
-
-wdprefix=/var/lib/gforge/plugins/mediawiki/wikidata
-
-# Minimal sanitisation of project name
-project=$(echo $project | sed s/[^-a-zA-Z0-9_]//g)
-if [ -d $wdprefix/$project ] ; then
-    rm -r $wdprefix/$project
-fi
-
-schema=$(echo plugin_mediawiki_$project | sed s/-/_/g)
-su -s /bin/sh postgres -c "/usr/bin/psql gforge" <<-EOF
-DROP SCHEMA $schema CASCADE;
-EOF

Added: trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,156 @@
+#! /usr/bin/php5
+<?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 FusionForge; if not, write to the Free Software
+   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   */
+
+  /** This script will automatically create mediawiki instances for
+   projects that do not yet have it.
+   
+   It is intended to be started in a cronjob.
+   */
+
+# TODO: How to use cronjob history?
+# Required variables:
+# $mediawiki_src_path: the directory where the mediawiki sources are installed
+# $mediawiki_var_path: the directory where mediawiki can store its data (i.e. LocalSettings.php and images/)
+
+require (dirname(__FILE__) . '/../../env.inc.php');
+require_once ($gfwww . 'include/squal_pre.php');
+require $gfcommon.'include/cron_utils.php';
+
+$project_settings_filename = "ProjectSettings.php";
+$upload_dir_basename = "images";
+
+if (!isset($mediawiki_var_path))
+	$mediawiki_var_path = "$sys_var_path/plugins/mediawiki";
+if (!isset($mediawiki_src_path))
+	$mediawiki_src_path = "/usr/share/mediawiki";
+if (!isset($mediawiki_projects_path))
+	$mediawiki_projects_path = "$mediawiki_var_path/projects";
+if (!isset($mediawiki_master_path))
+	$mediawiki_master_path = "$mediawiki_var_path/master";
+
+# Find the project settings template
+$project_settings_template = 
+	"$sys_etc_path/plugins/mediawiki/$project_settings_filename";
+if (!file_exists($project_settings_template))
+	$project_settings_template =
+		"$sys_opt_path/plugins/mediawiki/etc/plugins/mediawiki/$project_settings_filename";
+
+# Owner of files - apache
+$file_owner = $sys_apache_user.':'.$sys_apache_group;
+if (empty($sys_apache_user) || empty($sys_apache_group)) {
+	$err =  "Error: sys_apache_user Is Not Set Or sys_apache_group Is Not Set!";
+	cron_debug($err);
+	cron_entry(23,$err);
+	exit;
+}
+
+
+# Get all projects that use the mediawiki plugin
+$res = db_query ("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 = 'mediawiki';");
+if (!$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($res) ) {
+	$project = $row['unix_group_name'];
+	$project_dir = "$mediawiki_projects_path/$project";
+	cron_debug("Checking $project...");
+
+	// Check whether the image (and project) directory exists
+	$upload_dir = "$project_dir/$upload_dir_basename";
+	if (!is_dir($upload_dir)) {
+		cron_debug("  Creating upload dir $upload_dir.");
+		system("mkdir -p $upload_dir");
+	} else {
+		cron_debug("  Upload dir $upload_dir exists.");
+	}
+
+	// Check whether the project settings file exists
+	$project_settings = "$project_dir/$project_settings_filename";
+	if (!file_exists($project_settings)) {
+		cron_debug("  Copying $project_settings_template to $project_settings.");
+		if (!copy($project_settings_template, $project_settings)) {
+			$err = ("Error: Failed to copy $project_settings_template to $project_settings!");
+			cron_debug($err);
+			cron_entry(23,$err);
+		}
+		$create_db = true;
+	} else {
+		cron_debug("  File $project_settings exists.");
+		$create_db = false;
+	}
+
+	// Create the DB
+	if ($create_db) {
+		$schema = "plugin_mediawiki_$project";
+		// Sanitize schema name
+		strtr($schema, "-", "_");
+
+		cron_debug("  Creating schema $schema.");
+		$res = db_query("CREATE SCHEMA $schema ;");
+		if (!$res) {
+			$err =  "Error: Schema Creation Failed: " . 
+				db_error();
+			cron_debug($err);
+			cron_entry(23,$err);
+			exit;
+		}
+
+		cron_debug("  Creating mediawiki database.");
+		$table_file = "$mediawiki_src_path/maintenance/postgres/tables.sql";
+		if (!file_exists($table_file)) {
+			$err =  "Error: Couldn't find Mediawiki Database Creation File $mediawiki_creation_file!";
+			cron_debug($err);
+			cron_entry(23,$err);
+			exit;
+		}
+			
+		$creation_query = file_get_contents($table_file);
+		$res = db_query("SET search_path = \"$schema\" ;" 
+				. $creation_query
+				. "CREATE TEXT SEARCH CONFIGURATION $schema.default ( COPY = pg_catalog.english );"
+				. "COMMIT ;");
+		if (!$res) {
+			$err =  "Error: Mediawiki Database Creation Failed: " . 
+				db_error();
+			cron_debug($err);
+			cron_entry(23,$err);
+			exit;
+		}
+		
+
+	} else {
+		cron_debug("  Nothing to be done.");
+	}
+}
+
+
+  // Local Variables:
+  // mode: php
+  // c-file-style: "bsd"
+  // End:
+
+?>
\ No newline at end of file

Deleted: trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.sh	2010-03-19 17:37:22 UTC (rev 9152)
@@ -1,127 +0,0 @@
-#! /bin/sh
-
-sys_etc_path="/etc/gforge"
-sys_var_apth="/var/lib/gforge"
-
-# set the data dir for the plugin
-wdprefix=$sys_var_path/plugins/mediawiki/wikidata
-
-# get DB credentials
-tmp3=$(mktemp)
-perl -e'require "'$sys_etc_path'/local.pl"; print "*:*:$sys_dbname:$sys_dbuser:$sys_dbpasswd\n"' > $tmp3
-
-# get all projects that use the mediawiki plugin
-all_projects=$(echo "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 = 'mediawiki' ;" \
-    | PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge \
-    | tail -n +3 \
-    | grep '^ ')
-
-# create image directory and LocalSettings.php for all projects that don't have it yet
-for project in $all_projects ; do
-    if [ ! -d $wdprefix/$project/images ] ; then
-	mkdir -p $wdprefix/$project/images
-    fi
-    if [ ! -e $wdprefix/$project/LocalSettings.php ] ; then
-	cat > $wdprefix/$project/LocalSettings.php <<EOF
-<?php
-// To enable uploads for the wiki, you'll need to edit this value:
-\$wgEnableUploads = false;
-// Don't forget to "chown www-data $wdprefix/$project/images"
-
-// Edit permissions for group members
-\$wgGroupPermissions['Members']['edit']          = true;
-\$wgGroupPermissions['Members']['createpage']    = true;
-\$wgGroupPermissions['Members']['createtalk']    = true;
-
-// Edit permissions for non-members
-\$wgGroupPermissions['ForgeUsers']['edit']          = false;
-\$wgGroupPermissions['ForgeUsers']['createpage']    = false;
-\$wgGroupPermissions['ForgeUsers']['createtalk']    = false;
-
-// Edit permissions for anonymous users
-\$wgGroupPermissions['*']['edit']          = false;
-\$wgGroupPermissions['*']['createpage']    = false;
-\$wgGroupPermissions['*']['createtalk']    = false;
-
-// Uncomment these if you must import XML dumps
-//\$wgGroupPermissions['Administrators']['import']        = true;
-//\$wgGroupPermissions['Administrators']['importupload']  = true;
-// Uncomment these if you must edit the MediaWiki:Sidebar
-//\$wgGroupPermissions['Administrators']['editinterface'] = true;
-
-// Override default wiki logo
-//\$wgLogo = "/themes/\$sys_theme/images/wgLogo.png";
-
-EOF
-
-	new_projects="$new_projects $project"
-    fi
-done
-
-# create mediawiki database for all projects that started to use mediawiki
-for project in $new_projects ; do
-    schema=$(echo plugin_mediawiki_$project | sed s/-/_/g)
-
-    tmp1=$(mktemp)
-    tmp2=$(mktemp)
-
-    if su -s /bin/sh postgres -c "/usr/bin/psql gforge" 1> $tmp1 2> $tmp2 <<-EOF \
-        && [ "$(tail -n +2 $tmp1 | head -1)" = 'CREATE SCHEMA' ] ;
-SET LC_MESSAGES = 'C' ;
-CREATE SCHEMA $schema ;
-ALTER SCHEMA $schema OWNER TO gforge;
-EOF
-    then
-        rm -f $tmp1 $tmp2
-    else
-        echo "CREATE SCHEMA's STDOUT:"
-        cat $tmp1
-        echo "CREATE SCHEMA's STDERR:"
-        cat $tmp2
-        rm -f $tmp1 $tmp2 $tmp3
-	exit 1
-    fi
-
-    tmp1=$(mktemp)
-    tmp2=$(mktemp)
-
-    if PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge 1> $tmp1 2> $tmp2 <<-EOF \
-        && true || [ "$(tail -1 $tmp1)" = 'COMMIT' ] ;
-SET search_path = "$schema" ;
-\i /usr/share/mediawiki/maintenance/postgres/tables.sql
-CREATE TEXT SEARCH CONFIGURATION $schema.default ( COPY = pg_catalog.english );
-COMMIT ;
-EOF
-    then
-        rm -f $tmp1 $tmp2
-    else
-        echo "Database creation STDOUT:"
-        cat $tmp1
-        echo "Database creation STDERR:"
-        cat $tmp2
-        rm -f $tmp1 $tmp2 $tmp3
-        exit 1
-    fi
-
-done
-
-tmp4=$(mktemp)
-# Disable read anonymous if project is private
-for project in $all_projects ; do
-	ispublic=$(echo "SELECT is_public from groups where unix_group_name = '${project}' ;" \
-	    | PGPASSFILE=$tmp3 /usr/bin/psql -U gforge gforge \
-			| tail -n +3 \
-			| grep '^ ')
-
-	# Purge anonymous read
-	(fgrep -vie '$wgGroupPermissions['\''Members'\'']['\''read'\'']' \
-	    -e '$wgGroupPermissions['\''*'\'']['\''read'\'']' \
-	    $wdprefix/$project/LocalSettings.php
-	if [ $ispublic = '0' ] ; then
-		echo "\$wgGroupPermissions['Members']['read']    = true;"
-		echo "\$wgGroupPermissions['*']['read']          = false;"
-	fi) >$wdprefix/$project/LocalSettings.php
-
-done
-rm -f $tmp4
-rm -f $tmp3

Added: trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,2 @@
+# Create new mediawikis four times an hour
+*/15 * * * * $FFUSER $PHP $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php

Copied: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php (from rev 9151, trunk/gforge/plugins/mediawiki/www/LocalSettings.php)
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,240 @@
+<?php
+
+require_once('/etc/gforge/local.inc');
+
+if (!isset($mediawiki_var_path))
+	$mediawiki_var_path = "$sys_var_path/plugins/mediawiki";
+if (!isset($mediawiki_projects_path))
+	$mediawiki_projects_path = "$mediawiki_var_path/projects";
+if (!isset($mediawiki_master_path))
+	$mediawiki_master_path = "$mediawiki_var_path/master";
+
+if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+	// when loaded from the server
+        require_once ("$sys_opt_path/www/env.inc.php") ;
+	require_once ("$sys_opt_path/www/include/pre.php") ;
+} else {
+	// when run from the command line
+        require_once ("$sys_etc_path/database.inc") ;
+	require_once ("$sys_opt_path/common/include/config.php") ;
+}
+
+$IP = $mediawiki_master_path;
+
+$fusionforgeproject = 'siteadmin' ;
+$exppath = explode ('/', $_SERVER['PHP_SELF']) ;
+
+# determine $fusionforgeproject from the URL
+while (count ($exppath) >= 4) {
+        if (($exppath[0] == 'plugins') && ($exppath[1] == 'mediawiki') && ($exppath[2] == 'wiki') && ($exppath[4] == 'index.php')) {
+                $fusionforgeproject = $exppath[3] ;
+                break ;
+        } else {
+                array_shift ($exppath) ;
+        }
+}
+
+$project_dir = "$mediawiki_projects_path/$fusionforgeproject" ;
+
+$path = array( $IP, "$IP/includes", "$IP/languages" );
+set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
+
+require_once( "$IP/includes/DefaultSettings.php" );
+
+if (!isset($sys_dbport)) { $sys_dbport = 5432; }
+
+if ( $wgCommandLineMode ) {
+        if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+                die( "This script must be run from the command line\n" );
+        }
+}
+$wgSitename         = forge_get_config ('forge_name')." Wiki";
+$wgScriptPath       = "/plugins/mediawiki/wiki/$fusionforgeproject" ;
+
+$wgEmergencyContact = "webmaster at fusionforge.org";
+$wgPasswordSender = "webmaster at fusionforge.org";
+
+$wgDBtype           = "postgres";
+$wgDBserver         = $sys_dbhost ;
+$wgDBname           = $sys_dbname;
+$wgDBuser           = $sys_dbuser ;
+$wgDBpassword       = $sys_dbpasswd ;
+$wgDBadminuser           = $sys_dbuser ;
+$wgDBadminpassword       = $sys_dbpasswd ;
+$wgDBport           = $sys_dbport ;
+$wgDBmwschema       = str_replace ('-', '_', "plugin_mediawiki_$fusionforgeproject") ;
+$wgDBts2schema      = str_replace ('-', '_', "plugin_mediawiki_$fusionforgeproject") ;
+$wgMainCacheType = CACHE_NONE;
+$wgMemCachedServers = array();
+
+$wgEnableUploads = false;
+$wgUploadDirectory = "$project_dir/images";
+$wgUseImageMagick = true;
+$wgImageMagickConvertCommand = "/usr/bin/convert";
+$wgLocalInterwiki   = $wgSitename;
+$wgShowExceptionDetails = true ;
+
+$wgLanguageCode = "en";
+$wgDefaultSkin = 'fusionforge';
+
+$GLOBALS['sys_dbhost'] = $sys_dbhost ;
+$GLOBALS['sys_dbport'] = $sys_dbport ;
+$GLOBALS['sys_dbname'] = $sys_dbname ;
+$GLOBALS['sys_dbuser'] = $sys_dbuser ;
+$GLOBALS['sys_dbpasswd'] = $sys_dbpasswd ;
+$GLOBALS['sys_plugins_path'] = $sys_plugins_path ;
+$GLOBALS['sys_urlprefix'] = $sys_urlprefix ;
+$GLOBALS['sys_use_ssl'] = $sys_use_ssl ;
+$GLOBALS['sys_default_domain'] = $sys_default_domain ;
+$GLOBALS['sys_custom_path'] = $sys_custom_path ;
+$GLOBALS['gfwww'] = $gfwww ;
+$GLOBALS['gfplugins'] = $gfplugins ;
+$GLOBALS['sys_lang'] = $sys_lang ;
+$GLOBALS['sys_urlroot'] = $sys_urlroot;
+$GLOBALS['sys_session_key'] = $sys_session_key;
+$GLOBALS['sys_session_expire'] = $sys_session_expire;
+$GLOBALS['REMOTE_ADDR'] = getStringFromServer('REMOTE_ADDR') ;
+$GLOBALS['HTTP_USER_AGENT'] = getStringFromServer('HTTP_USER_AGENT') ;
+
+function FusionForgeMWAuth( $user, &$result ) {
+	global $fusionforgeproject ;
+
+	$cookie = getStringFromCookie ('session_ser') ;
+        if ($cookie != '') {
+                $s = session_check_session_cookie ($cookie);
+        } else {
+                $s = false ;
+        }
+        if ($s) {
+                $u = user_get_object ($s);
+		$g = group_get_object_by_name ($fusionforgeproject) ;
+		$perm =& $g->getPermission($u);
+
+                $mwname = ucfirst($u->getUnixName ()) ;
+                $mwu = User::newFromName ($mwname);
+                if($mwu->getID() == 0) {
+                        $mwu->addToDatabase ();
+                        $mwu->setPassword (User::randomPassword());
+                        $mwu->setRealName ($u->getRealName ()) ;
+                        $mwu->setToken ();
+                        $mwu->loadFromDatabase ();
+                }
+                $user->mId=$mwu->getID();
+                $user->loadFromId() ;
+
+		$user->loadGroups() ;
+		$current_groups = $user->getGroups() ;
+                if ($perm && is_object($perm) && $perm->isAdmin()) {
+                        if (!in_array ('sysop', $current_groups)) {
+                                $user->addGroup ('sysop') ;
+                        }
+                        if (!in_array ('Members', $current_groups)) {
+                                $user->addGroup ('Members') ;
+                        }
+                        if (!in_array ('ForgeUsers', $current_groups)) {
+                                $user->addGroup ('ForgeUsers') ;
+                        }
+                } elseif ($perm && is_object($perm) && $perm->isMember()) {
+                        if (in_array ('sysop', $current_groups)) {
+                                $user->removeGroup ('sysop') ;
+                        }
+                        if (!in_array ('Members', $current_groups)) {
+                                $user->addGroup ('Members') ;
+                        }
+                        if (!in_array ('ForgeUsers', $current_groups)) {
+                                $user->addGroup ('ForgeUsers') ;
+                        }
+                } else {
+                        if (in_array ('sysop', $current_groups)) {
+                                $user->removeGroup ('sysop') ;
+                        }
+                        if (in_array ('Members', $current_groups)) {
+                                $user->removeGroup ('Members') ;
+                        }
+                        if (!in_array ('ForgeUsers', $current_groups)) {
+                                $user->addGroup ('ForgeUsers') ;
+                        }
+                }
+
+                $user->setCookies ();
+                $user->saveSettings ();
+		wfSetupSession ();
+	} else {
+		$user->logout ();
+        }
+
+	$result = true;
+	return true ;
+}
+
+if (is_file("/etc/mediawiki-extensions/extensions.php")) {
+        include( "/etc/mediawiki-extensions/extensions.php" );
+}
+//function NoLogoutLinkOnMainPage(&$personal_urls){unset($personal_urls['logout']);return true;}
+//$wgHooks['PersonalUrls']['logout']='NoLogoutLinkOnMainPage';
+//function NoLoginLinkOnMainPage(&$personal_urls){unset($personal_urls['anonlogin']);return true;}
+//$wgHooks['PersonalUrls']['anonlogin']='NoLoginLinkOnMainPage';
+function NoLinkOnMainPage(&$personal_urls){
+	unset($personal_urls['anonlogin']);
+	unset($personal_urls['anontalk']);
+	unset($personal_urls['logout']);
+	unset($personal_urls['login']);
+	return true;
+}
+$wgHooks['PersonalUrls'][]='NoLinkOnMainPage';
+
+$GLOBALS['wgHooks']['UserLoadFromSession'][]='FusionForgeMWAuth';
+
+$wgGroupPermissions['Members']['createaccount'] = true;
+$wgGroupPermissions['Members']['edit']          = true;
+$wgGroupPermissions['Members']['createpage']    = true;
+$wgGroupPermissions['Members']['createtalk']    = true;
+
+$wgGroupPermissions['ForgeUsers']['createaccount'] = false;
+$wgGroupPermissions['ForgeUsers']['edit']          = false;
+$wgGroupPermissions['ForgeUsers']['createpage']    = false;
+$wgGroupPermissions['ForgeUsers']['createtalk']    = false;
+
+$wgGroupPermissions['user']['createaccount'] = false;
+$wgGroupPermissions['user']['edit']          = false;
+$wgGroupPermissions['user']['createpage']    = false;
+$wgGroupPermissions['user']['createtalk']    = false;
+
+$wgGroupPermissions['*']['createaccount'] = false;
+$wgGroupPermissions['*']['edit']          = false;
+$wgGroupPermissions['*']['createpage']    = false;
+$wgGroupPermissions['*']['createtalk']    = false;
+
+$res = db_query("SELECT is_public from groups where unix_group_name='$fusionforgeproject'") ;
+$row = db_fetch_array($res);
+$public = $row['is_public'];
+if ($public) {
+        // Disable read permissions for non-members
+	$wgGroupPermissions['Members']['read']          = true;
+	$wgGroupPermissions['ForgeUsers']['read']     	= true;
+	$wgGroupPermissions['user']['read']     	= true;
+	$wgGroupPermissions['*']['read']          	= true;
+} else {
+        // Disable read permissions for non-members
+	$wgGroupPermissions['Members']['read']          = true;
+	$wgGroupPermissions['ForgeUsers']['read']     	= false;
+	$wgGroupPermissions['user']['read']     	= false;
+	$wgGroupPermissions['*']['read']          	= false;
+} 
+
+if (file_exists ("$project_dir/ProjectSettings.php")) {
+        require ("$project_dir/ProjectSettings.php") ;
+} else {
+	exit_error (sprintf(_('Mediawiki for project %s not created yet, please wait for a few minutes.'), $fusionforgeproject)) ;
+}
+
+// Override default wiki logo
+$wgLogo = "/themes/$sys_theme/images/wgLogo.png";
+$wgFavicon = '/images/icon.png' ;
+$wgBreakFrames = false ;
+ini_set ('memory_limit', '50M') ;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:

Added: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.php
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,13 @@
+<?php 
+
+// To enable uploads for the wiki, you'll need to edit this value:
+$wgEnableUploads = false;
+
+// Uncomment these if you must import XML dumps
+//$wgGroupPermissions['Administrators']['import']        = true;
+//$wgGroupPermissions['Administrators']['importupload']  = true;
+// Uncomment these if you must edit the MediaWiki:Sidebar
+//$wgGroupPermissions['Administrators']['editinterface'] = true;
+
+
+?>
\ No newline at end of file

Added: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/config.php
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/config.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/config.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,10 @@
+<?php
+
+// If you change the following, don't forget to adapt httpd.d 
+// accordingly
+# $mediawiki_var_path = "$sys_var_path/plugins/mediawiki";
+# $mediawiki_src_path = "/usr/share/mediawiki";
+# $mediawiki_projects_path = "$mediawiki_var_path/projects"
+# $mediawiki_master_path = "$mediawiki_var_path/master"
+
+?>
\ No newline at end of file

Added: trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php
===================================================================
--- trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -0,0 +1,147 @@
+#! /usr/bin/php5
+<?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 FusionForge; if not, write to the Free Software
+   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   */
+
+  /** This script will set up the structure required to use the
+   mediawiki plugin. 
+   
+   It is usually started from the plugin manager, but can also be
+   started manually.
+   */
+
+if ( isset( $_SERVER ) && 
+     array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+	$command_line = false;
+} else {
+	require('/etc/gforge/local.inc');
+	require_once (dirname(__FILE__) . '/../../env.inc.php');
+	$command_line = true;
+}
+
+if (!isset($mediawiki_var_path))
+	$mediawiki_var_path = "$sys_var_path/plugins/mediawiki";
+if (!isset($mediawiki_projects_path))
+	$mediawiki_projects_path = "$mediawiki_var_path/projects";
+if (!isset($mediawiki_master_path))
+	$mediawiki_master_path = "$mediawiki_var_path/master";
+
+# create directories
+if (!is_dir($mediawiki_projects_path))
+  system("mkdir -p $mediawiki_projects_path");
+if (!is_dir($mediawiki_master_path))
+  system("mkdir -p $mediawiki_master_path");
+
+function mysymlink($from, $to) {
+	global $mw_feedback;
+	if (!@symlink($from, $to))
+		$mw_feedback[] = sprintf(_('Could not create symbolic link from %1$s to %1$s'), $from, $to);
+}
+
+$mw_feedback = array();
+# install links in master
+# link files from $mediawiki_src_path to $mediawiki_master_path
+if (!($dh = opendir($mediawiki_src_path))) {
+	$mw_feedback[] = sprintf(_('Could not open mediawiki source directory %1$s!'), $mediawiki_src_path);
+} 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 = "$mediawiki_src_path/$file";
+			$to = "$mediawiki_master_path/$file";
+			mysymlink($from, $to);
+		}
+	}
+	closedir ($dh);
+}
+
+# link LocalSettings.php from /etc/gforge/plugins/mediawiki/LocalSettings.php or from $sys_opt_path/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
+$from = "$sys_etc_path/plugins/mediawiki/LocalSettings.php";
+if (!file_exists($from)) {
+	$from = "$sys_opt_path/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php";
+}
+$to = "$mediawiki_master_path/LocalSettings.php";
+mysymlink($from, $to);
+
+# create skin directory
+$todir = "$mediawiki_master_path/skins";
+if (!is_dir($todir))
+	mkdir($todir);
+
+# link FusionForge skin file
+$fromdir = "$sys_opt_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 main.css files
+$fromdir = "$fromdir/fusionforge";
+$from = "$fromdir/main.css";
+$to = "$todir/main.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,
+	'main.css' => true,
+	);
+while ($file = readdir($dh)) {
+	if (!$ignore_file[$file]) {
+		$from = "$fromdir/$file";
+		$to = "$todir/$file";
+		mysymlink($from, $to);
+	}
+}
+closedir($dh);
+
+if ($command_line) {
+	foreach ($mw_feedback as $line) {
+		echo "$line\n";
+	}
+} else {
+	foreach ($mw_feedback as $line) {
+		$feedback .= "<br />$line";
+	}
+	$feedback .= "<br />";
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Deleted: trunk/gforge/plugins/mediawiki/www/LocalSettings.php
===================================================================
--- trunk/gforge/plugins/mediawiki/www/LocalSettings.php	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/plugins/mediawiki/www/LocalSettings.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -1,221 +0,0 @@
-<?php
-
-$sys_etc_path = "/etc/gforge";
-$sys_opt_path = "/usr/share/gforge";
-$sys_var_path = "/var/lib/gforge";
-
-define('MW_INSTALL_PATH', "$sys_opt_path/www/plugins/mediawiki/wikisrc");
-
-$fusionforgeproject = 'siteadmin' ;
-$exppath = explode ('/', $_SERVER['PHP_SELF']) ;
-
-# determine $fusionforgeproject
-while (count ($exppath) >= 4) {
-        if (($exppath[0] == 'plugins') && ($exppath[1] == 'mediawiki') && ($exppath[2] == 'wiki') && ($exppath[4] == 'index.php')) {
-                $fusionforgeproject = $exppath[3] ;
-                break ;
-        } else {
-                array_shift ($exppath) ;
-        }
-}
-
-$wikidata = $sys_var_path . "plugins/mediawiki/wikidata/$fusionforgeproject" ;
-
-if( defined( 'MW_INSTALL_PATH' ) ) {
-        $IP = MW_INSTALL_PATH;
-} else {
-        $IP = dirname( __FILE__ );
-}
-
-$path = array( $IP, "$IP/includes", "$IP/languages" );
-set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
-
-require_once( "$IP/includes/DefaultSettings.php" );
-
-if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
-        require_once ("$sys_etc_path/local.inc") ;
-        require_once ("$sys_opt_path/www/env.inc.php") ;
-} else {
-        require_once ("$sys_etc_path/database.inc") ;
-}
-$sys_dbport = 5432;
-
-if ( $wgCommandLineMode ) {
-        if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
-                die( "This script must be run from the command line\n" );
-        }
-}
-$wgSitename         = forge_get_config ('forge_name')." Wiki";
-$wgScriptPath       = "/plugins/mediawiki/wiki/$fusionforgeproject" ;
-
-$wgEmergencyContact = "webmaster at fusionforge.org";
-$wgPasswordSender = "webmaster at fusionforge.org";
-
-$wgDBtype           = "postgres";
-$wgDBserver         = $sys_dbhost ;
-$wgDBname           = $sys_dbname;
-$wgDBuser           = $sys_dbuser ;
-$wgDBpassword       = $sys_dbpasswd ;
-$wgDBadminuser           = $sys_dbuser ;
-$wgDBadminpassword       = $sys_dbpasswd ;
-$wgDBport           = $sys_dbport ;
-$wgDBmwschema       = str_replace ('-', '_', "plugin_mediawiki_$fusionforgeproject") ;
-$wgDBts2schema      = str_replace ('-', '_', "plugin_mediawiki_$fusionforgeproject") ;
-$wgMainCacheType = CACHE_NONE;
-$wgMemCachedServers = array();
-
-$wgEnableUploads = false;
-$wgUploadDirectory = "$wikidata/images";
-$wgUseImageMagick = true;
-$wgImageMagickConvertCommand = "/usr/bin/convert";
-$wgLocalInterwiki   = $wgSitename;
-$wgShowExceptionDetails = true ;
-
-$wgLanguageCode = "en";
-$wgDefaultSkin = 'fusionforge';
-
-$GLOBALS['sys_dbhost'] = $sys_dbhost ;
-$GLOBALS['sys_dbport'] = $sys_dbport ;
-$GLOBALS['sys_dbname'] = $sys_dbname ;
-$GLOBALS['sys_dbuser'] = $sys_dbuser ;
-$GLOBALS['sys_dbpasswd'] = $sys_dbpasswd ;
-$GLOBALS['sys_plugins_path'] = $sys_plugins_path ;
-$GLOBALS['sys_urlprefix'] = $sys_urlprefix ;
-$GLOBALS['sys_use_ssl'] = $sys_use_ssl ;
-$GLOBALS['sys_default_domain'] = $sys_default_domain ;
-$GLOBALS['sys_custom_path'] = $sys_custom_path ;
-$GLOBALS['gfwww'] = $gfwww ;
-$GLOBALS['gfplugins'] = $gfplugins ;
-$GLOBALS['sys_lang'] = $sys_lang ;
-require ("$sys_opt_path/www/include/pre.php") ;
-$GLOBALS['sys_urlroot'] = $sys_urlroot;
-$GLOBALS['sys_session_key'] = $sys_session_key;
-$GLOBALS['sys_session_expire'] = $sys_session_expire;
-$GLOBALS['REMOTE_ADDR'] = getStringFromServer('REMOTE_ADDR') ;
-$GLOBALS['HTTP_USER_AGENT'] = getStringFromServer('HTTP_USER_AGENT') ;
-
-function FusionForgeMWAuth( $user, &$result ) {
-	global $fusionforgeproject ;
-
-	$cookie = getStringFromCookie ('session_ser') ;
-        if ($cookie != '') {
-                $s = session_check_session_cookie ($cookie);
-        } else {
-                $s = false ;
-        }
-        if ($s) {
-                $u = user_get_object ($s);
-		$g = group_get_object_by_name ($fusionforgeproject) ;
-		$perm =& $g->getPermission($u);
-
-                $mwname = ucfirst($u->getUnixName ()) ;
-                $mwu = User::newFromName ($mwname);
-                if($mwu->getID() == 0) {
-                        $mwu->addToDatabase ();
-                        $mwu->setPassword (User::randomPassword());
-                        $mwu->setRealName ($u->getRealName ()) ;
-                        $mwu->setToken ();
-                        $mwu->loadFromDatabase ();
-                }
-                $user->mId=$mwu->getID();
-                $user->loadFromId() ;
-
-		$user->loadGroups() ;
-		$current_groups = $user->getGroups() ;
-                if ($perm && is_object($perm) && $perm->isAdmin()) {
-                        if (!in_array ('sysop', $current_groups)) {
-                                $user->addGroup ('sysop') ;
-                        }
-                        if (!in_array ('Members', $current_groups)) {
-                                $user->addGroup ('Members') ;
-                        }
-                        if (!in_array ('ForgeUsers', $current_groups)) {
-                                $user->addGroup ('ForgeUsers') ;
-                        }
-                } elseif ($perm && is_object($perm) && $perm->isMember()) {
-                        if (in_array ('sysop', $current_groups)) {
-                                $user->removeGroup ('sysop') ;
-                        }
-                        if (!in_array ('Members', $current_groups)) {
-                                $user->addGroup ('Members') ;
-                        }
-                        if (!in_array ('ForgeUsers', $current_groups)) {
-                                $user->addGroup ('ForgeUsers') ;
-                        }
-                } else {
-                        if (in_array ('sysop', $current_groups)) {
-                                $user->removeGroup ('sysop') ;
-                        }
-                        if (in_array ('Members', $current_groups)) {
-                                $user->removeGroup ('Members') ;
-                        }
-                        if (!in_array ('ForgeUsers', $current_groups)) {
-                                $user->addGroup ('ForgeUsers') ;
-                        }
-                }
-
-                $user->setCookies ();
-                $user->saveSettings ();
-		wfSetupSession ();
-	} else {
-		$user->logout ();
-        }
-
-	$result = true;
-	return true ;
-}
-
-if (is_file("/etc/mediawiki-extensions/extensions.php")) {
-        include( "/etc/mediawiki-extensions/extensions.php" );
-}
-//function NoLogoutLinkOnMainPage(&$personal_urls){unset($personal_urls['logout']);return true;}
-//$wgHooks['PersonalUrls']['logout']='NoLogoutLinkOnMainPage';
-//function NoLoginLinkOnMainPage(&$personal_urls){unset($personal_urls['anonlogin']);return true;}
-//$wgHooks['PersonalUrls']['anonlogin']='NoLoginLinkOnMainPage';
-function NoLinkOnMainPage(&$personal_urls){
-	unset($personal_urls['anonlogin']);
-	unset($personal_urls['anontalk']);
-	unset($personal_urls['logout']);
-	unset($personal_urls['login']);
-	return true;
-}
-$wgHooks['PersonalUrls'][]='NoLinkOnMainPage';
-
-$GLOBALS['wgHooks']['UserLoadFromSession'][]='FusionForgeMWAuth';
-
-$wgGroupPermissions['Members']['createaccount'] = true;
-$wgGroupPermissions['Members']['edit']          = true;
-$wgGroupPermissions['Members']['createpage']    = true;
-$wgGroupPermissions['Members']['createtalk']    = true;
-
-$wgGroupPermissions['ForgeUsers']['createaccount'] = false;
-$wgGroupPermissions['ForgeUsers']['edit']          = false;
-$wgGroupPermissions['ForgeUsers']['createpage']    = false;
-$wgGroupPermissions['ForgeUsers']['createtalk']    = false;
-
-$wgGroupPermissions['user']['createaccount'] = false;
-$wgGroupPermissions['user']['edit']          = false;
-$wgGroupPermissions['user']['createpage']    = false;
-$wgGroupPermissions['user']['createtalk']    = false;
-
-$wgGroupPermissions['*']['createaccount'] = false;
-$wgGroupPermissions['*']['edit']          = false;
-$wgGroupPermissions['*']['createpage']    = false;
-$wgGroupPermissions['*']['createtalk']    = false;
-
-$wgLogo = "/themes/$sys_theme/images/wgLogo.png";
-
-if (file_exists ("$wikidata/LocalSettings.php")) {
-        require ("$wikidata/LocalSettings.php") ;
-} else {
-	exit_error (_('Wiki not created yet, please wait for a few minutes.')) ;
-}
-
-$wgFavicon = '/images/icon.png' ;
-$wgBreakFrames = false ;
-ini_set ('memory_limit', '50M') ;
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:

Modified: trunk/gforge/www/admin/pluginman.php
===================================================================
--- trunk/gforge/www/admin/pluginman.php	2010-03-19 15:36:01 UTC (rev 9151)
+++ trunk/gforge/www/admin/pluginman.php	2010-03-19 17:37:22 UTC (rev 9152)
@@ -81,7 +81,7 @@
 				$feedback .= sprintf(ngettext('%d project detached from plugin.', '%d projects detached from plugin.', db_affected_rows($res)), db_affected_rows($res));
 			}
 		}
-		$res = $pm->desactivate($pluginname);
+		$res = $pm->deactivate($pluginname);
 		if (!$res) {
 			exit_error("SQL ERROR",db_error());
 		} else {
@@ -181,13 +181,13 @@
 }
 
 if ($feedback) echo '<div class="feedback">' . $feedback . '</div>';
-echo _('Here you can activate / deactivate Site wide plugins which are in the plugins/ folder. Then, you should activate them also per project, per user or whatever the plugin specifically applies to.<br /><span class="important">Be careful because some groups/users can be using the plugin. Deactivating it will remove the plugin from all users/groups.<br />Be EXTRA careful running the SQL init script when a plugin has been deactivated prior use (and you want to re-activate) because some scripts have DROP TABLE statements</span><br /><br />');
+echo _('Here you can activate / deactivate site-wide plugins which are in the plugins/ folder. Then, you should activate them also per project, per user or whatever the plugin specifically applies to.<br /><span class="important">Be careful because some groups/users can be using the plugin. Deactivating it will remove the plugin from all users/groups.<br />Be <strong>extra</strong> careful not to run the init-script again when the plugin is reactivated, because some scripts have DROP TABLE statements.</span><br /><br />');
 $title_arr = array( _('Plugin Name'),
-				_('Status'),
-				_('Action'),
-				_('Run Init Script?'),
-				_('Users Using it'),
-				_('Groups Using it'),);
+		    _('Status'),
+		    _('Action'),
+		    _('Run Init Script?'),
+		    _('Users Using it'),
+		    _('Groups Using it'),);
 echo $HTML->listTableTop($title_arr);
 
 // Get the activated plugins.




More information about the Fusionforge-commits mailing list