[Fusionforge-commits] r9600 - in trunk/gforge: packaging/cron.d plugins/mediawiki/bin plugins/mediawiki/cronjobs plugins/mediawiki/etc plugins/mediawiki/etc/cron.d plugins/mediawiki/etc/plugins/mediawiki plugins/mediawiki/scripts

Olaf Lenz olenz at libremir.placard.fr.eu.org
Fri Apr 23 17:40:28 CEST 2010


Author: olenz
Date: 2010-04-23 17:40:28 +0200 (Fri, 23 Apr 2010)
New Revision: 9600

Added:
   trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php
   trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php
   trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php
   trunk/gforge/plugins/mediawiki/etc/config.ini
Removed:
   trunk/gforge/plugins/mediawiki/bin/drop-wiki.php
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.template.php
   trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php
Modified:
   trunk/gforge/packaging/cron.d/plugin-mediawiki
   trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php
   trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
Log:
mediawiki-plugin uses config now. Uploads can be enabled in config.ini now. Prefixed bin/-scripts with "mw-".

Modified: trunk/gforge/packaging/cron.d/plugin-mediawiki
===================================================================
--- trunk/gforge/packaging/cron.d/plugin-mediawiki	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/packaging/cron.d/plugin-mediawiki	2010-04-23 15:40:28 UTC (rev 9600)
@@ -2,5 +2,6 @@
 # Regular cron jobs for plugin-mediawiki
 #
 
-# Create new wikis four times an hour
-*/15 * * * * root [ -x $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php ] && $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php
+# Create new wikis and imgdirs four times an hour
+0,15,30,45 * * * * $FFUSER [ -x $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php ] && $PHP $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php
+1,16,31,46 * * * * root [ -x $FFDIR/plugins/mediawiki/cronjobs/create-imgdirs.php ] && $PHP $FFDIR/plugins/mediawiki/cronjobs/create-imgdirs.php

Deleted: trunk/gforge/plugins/mediawiki/bin/drop-wiki.php
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/drop-wiki.php	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/plugins/mediawiki/bin/drop-wiki.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -1,64 +0,0 @@
-#! /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_params("DROP SCHEMA $schema CASCADE", array());
-  if (!$res) {
-    echo db_error();
-  }
-}
-
-  // Local Variables:
-  // mode: php
-  // c-file-style: "bsd"
-  // End:
-
-?>
-

Copied: trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php (from rev 9599, trunk/gforge/plugins/mediawiki/bin/drop-wiki.php)
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -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_params("DROP SCHEMA $schema CASCADE", array());
+  if (!$res) {
+    echo db_error();
+  }
+}
+
+  // Local Variables:
+  // mode: php
+  // c-file-style: "bsd"
+  // End:
+
+?>
+

Copied: trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php (from rev 9599, trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php)
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -0,0 +1,146 @@
+#! /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_share_path/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
+$from = "$sys_etc_path/plugins/mediawiki/LocalSettings.php";
+if (!file_exists($from)) {
+	$from = "$sys_share_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_share_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);
+
+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:
+
+?>

Added: trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -0,0 +1,79 @@
+#! /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 the image upload
+   directories for all mediawiki instances.
+   
+   It is intended to be started in a cronjob with root permissions.
+   */
+
+require (dirname(__FILE__) . '/../../env.inc.php');
+require_once ($gfwww . 'include/squal_pre.php');
+require $gfcommon.'include/cron_utils.php';
+require(dirname(__FILE__) . '/../common/config-vars.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, group and permission of upload dir $upload_dir.");
+		chown($project_dir, $dir_owner);
+		chgrp($project_dir, $dir_group);
+		chmod($project_dir, 0775);
+	}
+} else {
+	cron_debug("Mediawiki uploads not enabled, quitting create-imagedirs.php!");
+}
+  // Local Variables:
+  // mode: php
+  // c-file-style: "bsd"
+  // End:
+
+?>

Modified: trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -27,41 +27,18 @@
    */
 
 # 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/)
+# Required config variables:
+#   src_path: the directory where the mediawiki sources are installed
+#   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';
+require(dirname(__FILE__) . '/../common/config-vars.php');
 
-$upload_dir_basename = "images";
+$src_path = forge_get_config('src_path', 'mediawiki');
+$master_path = forge_get_config('master_path', 'mediawiki');
 
-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/ProjectSettings.template.php";
-if (!file_exists($project_settings_template))
-	$project_settings_template =
-		"$sys_share_path/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.template.php";
-
-# Owner of files - apache
-$file_owner = forge_get_config('apache_user').':'.forge_get_config('apache_group');
-if (forge_get_config('apache_user') == '' || forge_get_config('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
 $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) {
@@ -74,35 +51,18 @@
 # Loop over all projects that use the plugin
 while ( $row = db_fetch_array($project_res) ) {
 	$project = $row['unix_group_name'];
-	$project_dir = "$mediawiki_projects_path/$project";
+	$project_dir = forge_get_config('projects_path', 'mediawiki') 
+		. "/$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");
+	// 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 {
-		cron_debug("  Upload dir $upload_dir exists.");
-	}
+		cron_debug("  Creating project dir $project_dir.");
+		mkdir($project_dir, 0775, true);
 
-	// Check whether the project settings file exists
-	$project_settings = "$project_dir/ProjectSettings.php";
-	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) {
+		// Create the DB
 		$schema = "plugin_mediawiki_$project";
 		// Sanitize schema name
 		strtr($schema, "-", "_");
@@ -121,9 +81,9 @@
 		}
 
 		cron_debug("  Creating mediawiki database.");
-		$table_file = "$mediawiki_src_path/maintenance/postgres/tables.sql";
+		$table_file = "$src_path/maintenance/postgres/tables.sql";
 		if (!file_exists($table_file)) {
-			$err =  "Error: Couldn't find Mediawiki Database Creation File $mediawiki_creation_file!";
+			$err =  "Error: Couldn't find Mediawiki Database Creation File $table_file!";
 			cron_debug($err);
 			cron_entry(23,$err);
 			db_rollback();
@@ -176,9 +136,7 @@
 			system ("$mwwrapper $project importDump.php $dumpfile") ;
 			system ("$mwwrapper $project rebuildrecentchanges.php") ;
 		}
-	} else {
-		cron_debug("  Nothing to be done.");
-	}
+	} 
 }
 
 

Added: trunk/gforge/plugins/mediawiki/etc/config.ini
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/config.ini	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/etc/config.ini	2010-04-23 15:40:28 UTC (rev 9600)
@@ -0,0 +1,15 @@
+[mediawiki]
+## Whether uploads are allowed on the mediawiki
+# enable_uploads = false
+
+## Source dir of the mediawiki source code.
+# src_path = /usr/share/mediawiki
+
+## Mediawiki projects dir. 
+## All projects using the plugin have a subdirectory in this directory.
+# projects_path = <sys_var_path>/plugins/mediawiki/projects
+
+## Mediawiki master dir.
+## This is where all the links to the mediawiki source code are stored.
+# master_path = <sys_var_path>/plugins/mediawiki/master
+

Modified: trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/plugins/mediawiki/etc/cron.d/mediawiki	2010-04-23 15:40:28 UTC (rev 9600)
@@ -1,2 +1,3 @@
 # Create new mediawikis four times an hour
-*/15 * * * * $FFUSER $PHP $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php
+0,15,30,45 * * * * $FFUSER [ -x $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php ] && $PHP $FFDIR/plugins/mediawiki/cronjobs/create-wikis.php
+1,16,31,46 * * * * root [ -x $FFDIR/plugins/mediawiki/cronjobs/create-imgdirs.php ] && $PHP $FFDIR/plugins/mediawiki/cronjobs/create-imgdirs.php

Modified: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -2,13 +2,6 @@
 
 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_share_path/www/env.inc.php") ;
@@ -19,8 +12,10 @@
 	require_once ("$sys_share_path/common/include/config.php") ;
 }
 
-$IP = $mediawiki_master_path;
+require_once ("$sys_share_path/plugins/mediawiki/common/config-vars.php");
 
+$IP = forge_get_config('master_path', 'mediawiki');
+
 if (!isset ($fusionforgeproject)) {
 	$fusionforgeproject = 'siteadmin' ;
 }
@@ -36,8 +31,14 @@
         }
 }
 
-$project_dir = "$mediawiki_projects_path/$fusionforgeproject" ;
+$project_dir = forge_get_config('projects_path', 'mediawiki') . "/" 
+	. $fusionforgeproject ;
 
+if (!is_dir($project_dir)) {
+	exit_error (sprintf(_('Mediawiki for project %s not created yet, please wait for a few minutes.'), $fusionforgeproject)) ;
+}
+
+
 $path = array( $IP, "$IP/includes", "$IP/languages" );
 set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );
 
@@ -70,7 +71,7 @@
 $wgMainCacheType = CACHE_NONE;
 $wgMemCachedServers = array();
 
-$wgEnableUploads = false;
+$wgEnableUploads = forge_get_config('enable_uploads', 'mediawiki');
 $wgUploadDirectory = "$project_dir/images";
 $wgUseImageMagick = true;
 $wgImageMagickConvertCommand = "/usr/bin/convert";
@@ -181,7 +182,6 @@
 
                 $user->setCookies ();
                 $user->saveSettings ();
-		session_destroy () ;
 		wfSetupSession ();
 	} else {
 		$user->logout ();
@@ -266,12 +266,9 @@
 
 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/".forge_get_config('default_theme')."/images/wgLogo.png";
 $wgFavicon = '/images/icon.png' ;
 $wgBreakFrames = false ;
 ini_set ('memory_limit', '50M') ;

Deleted: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.template.php
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.template.php	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/ProjectSettings.template.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -1,13 +0,0 @@
-<?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

Deleted: trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php
===================================================================
--- trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php	2010-04-23 15:40:20 UTC (rev 9599)
+++ trunk/gforge/plugins/mediawiki/scripts/mediawiki-plugin-init.php	2010-04-23 15:40:28 UTC (rev 9600)
@@ -1,146 +0,0 @@
-#! /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_share_path/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
-$from = "$sys_etc_path/plugins/mediawiki/LocalSettings.php";
-if (!file_exists($from)) {
-	$from = "$sys_share_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_share_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);
-
-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:
-
-?>




More information about the Fusionforge-commits mailing list