[Fusionforge-commits] r9603 - in trunk/gforge: packaging/links plugins/mediawiki/bin plugins/mediawiki/cronjobs plugins/mediawiki/etc/plugins/mediawiki plugins/mediawiki/www

Olaf Lenz olenz at libremir.placard.fr.eu.org
Mon Apr 26 13:29:54 CEST 2010


Author: olenz
Date: 2010-04-26 13:29:54 +0200 (Mon, 26 Apr 2010)
New Revision: 9603

Added:
   trunk/gforge/packaging/links/plugin-mediawiki
   trunk/gforge/plugins/mediawiki/www/LocalSettings.php
Removed:
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
Modified:
   trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php
   trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php
   trunk/gforge/plugins/mediawiki/bin/mw-wrapper.php
   trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php
   trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php
Log:
Unified includes, readded link creation in packaging.

Added: trunk/gforge/packaging/links/plugin-mediawiki
===================================================================
--- trunk/gforge/packaging/links/plugin-mediawiki	                        (rev 0)
+++ trunk/gforge/packaging/links/plugin-mediawiki	2010-04-26 11:29:54 UTC (rev 9603)
@@ -0,0 +1,73 @@
+/usr/share/gforge/plugins/mediawiki/www/LocalSettings.php /var/lib/gforge/plugins/mediawiki/master/LocalSettings.php
+/usr/share/gforge/plugins/mediawiki/mediawiki-skin/FusionForge.php /var/lib/gforge/plugins/mediawiki/master/skins/FusionForge.php
+/usr/share/gforge/plugins/mediawiki/mediawiki-skin/fusionforge/fusionforge.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/fusionforge.css
+
+/usr/share/mediawiki/CREDITS /var/lib/gforge/plugins/mediawiki/master/CREDITS
+/usr/share/mediawiki/INSTALL /var/lib/gforge/plugins/mediawiki/master/INSTALL
+/usr/share/mediawiki/bin /var/lib/gforge/plugins/mediawiki/master/bin
+/usr/share/mediawiki/maintenance /var/lib/gforge/plugins/mediawiki/master/maintenance
+/usr/share/mediawiki/Makefile /var/lib/gforge/plugins/mediawiki/master/Makefile
+/usr/share/mediawiki/api.php5 /var/lib/gforge/plugins/mediawiki/master/api.php5
+/usr/share/mediawiki/index.php5 /var/lib/gforge/plugins/mediawiki/master/index.php5
+/usr/share/mediawiki/opensearch_desc.php5 /var/lib/gforge/plugins/mediawiki/master/opensearch_desc.php5
+/usr/share/mediawiki/docs /var/lib/gforge/plugins/mediawiki/master/docs
+/usr/share/mediawiki/AdminSettings.sample /var/lib/gforge/plugins/mediawiki/master/AdminSettings.sample
+/usr/share/mediawiki/thumb.php5 /var/lib/gforge/plugins/mediawiki/master/thumb.php5
+/usr/share/mediawiki/img_auth.php /var/lib/gforge/plugins/mediawiki/master/img_auth.php
+/usr/share/mediawiki/HISTORY /var/lib/gforge/plugins/mediawiki/master/HISTORY
+/usr/share/mediawiki/api.php /var/lib/gforge/plugins/mediawiki/master/api.php
+/usr/share/mediawiki/thumb.php /var/lib/gforge/plugins/mediawiki/master/thumb.php
+/usr/share/mediawiki/redirect.phtml /var/lib/gforge/plugins/mediawiki/master/redirect.phtml
+/usr/share/mediawiki/install-utils.inc /var/lib/gforge/plugins/mediawiki/master/install-utils.inc
+/usr/share/mediawiki/COPYING /var/lib/gforge/plugins/mediawiki/master/COPYING
+/usr/share/mediawiki/languages /var/lib/gforge/plugins/mediawiki/master/languages
+/usr/share/mediawiki/README /var/lib/gforge/plugins/mediawiki/master/README
+/usr/share/mediawiki/php5.php5 /var/lib/gforge/plugins/mediawiki/master/php5.php5
+/usr/share/mediawiki/opensearch_desc.php /var/lib/gforge/plugins/mediawiki/master/opensearch_desc.php
+/usr/share/mediawiki/UPGRADE /var/lib/gforge/plugins/mediawiki/master/UPGRADE
+/usr/share/mediawiki/StartProfiler.php /var/lib/gforge/plugins/mediawiki/master/StartProfiler.php
+/usr/share/mediawiki/index.php /var/lib/gforge/plugins/mediawiki/master/index.php
+/usr/share/mediawiki/trackback.php5 /var/lib/gforge/plugins/mediawiki/master/trackback.php5
+/usr/share/mediawiki/FAQ /var/lib/gforge/plugins/mediawiki/master/FAQ
+/usr/share/mediawiki/serialized /var/lib/gforge/plugins/mediawiki/master/serialized
+/usr/share/mediawiki/extensions /var/lib/gforge/plugins/mediawiki/master/extensions
+/usr/share/mediawiki/RELEASE-NOTES /var/lib/gforge/plugins/mediawiki/master/RELEASE-NOTES
+/usr/share/mediawiki/redirect.php5 /var/lib/gforge/plugins/mediawiki/master/redirect.php5
+/usr/share/mediawiki/includes /var/lib/gforge/plugins/mediawiki/master/includes
+/usr/share/mediawiki/wiki.phtml /var/lib/gforge/plugins/mediawiki/master/wiki.phtml
+/usr/share/mediawiki/profileinfo.php /var/lib/gforge/plugins/mediawiki/master/profileinfo.php
+/usr/share/mediawiki/math /var/lib/gforge/plugins/mediawiki/master/math
+/usr/share/mediawiki/redirect.php /var/lib/gforge/plugins/mediawiki/master/redirect.php
+/usr/share/mediawiki/img_auth.php5 /var/lib/gforge/plugins/mediawiki/master/img_auth.php5
+/usr/share/mediawiki/trackback.php /var/lib/gforge/plugins/mediawiki/master/trackback.php
+
+/usr/share/mediawiki/skins/monobook/link_icon.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/link_icon.gif
+/usr/share/mediawiki/skins/monobook/file_icon.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/file_icon.gif
+/usr/share/mediawiki/skins/monobook/required.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/required.gif
+/usr/share/mediawiki/skins/monobook/rtl.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/rtl.css
+/usr/share/mediawiki/skins/monobook/wiki-indexed.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/wiki-indexed.png
+/usr/share/mediawiki/skins/monobook/user.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/user.gif
+/usr/share/mediawiki/skins/monobook/audio.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/audio.png
+/usr/share/mediawiki/skins/monobook/wiki.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/wiki.png
+/usr/share/mediawiki/skins/monobook/mail_icon.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/mail_icon.gif
+/usr/share/mediawiki/skins/monobook/FF2Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/FF2Fixes.css
+/usr/share/mediawiki/skins/monobook/bullet.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/bullet.gif
+/usr/share/mediawiki/skins/monobook/headbg.jpg /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/headbg.jpg
+/usr/share/mediawiki/skins/monobook/external-rtl.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/external-rtl.png
+/usr/share/mediawiki/skins/monobook/IE55Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/IE55Fixes.css
+/usr/share/mediawiki/skins/monobook/Opera9Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/Opera9Fixes.css
+/usr/share/mediawiki/skins/monobook/IE50Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/IE50Fixes.css
+/usr/share/mediawiki/skins/monobook/news_icon.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/news_icon.png
+/usr/share/mediawiki/skins/monobook/Opera7Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/Opera7Fixes.css
+/usr/share/mediawiki/skins/monobook/document.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/document.png
+/usr/share/mediawiki/skins/monobook/KHTMLFixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/KHTMLFixes.css
+/usr/share/mediawiki/skins/monobook/lock_icon.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/lock_icon.gif
+/usr/share/mediawiki/skins/monobook/external.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/external.png
+/usr/share/mediawiki/skins/monobook/discussionitem_icon.gif /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/discussionitem_icon.gif
+/usr/share/mediawiki/skins/monobook/video.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/video.png
+/usr/share/mediawiki/skins/monobook/IE60Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/IE60Fixes.css
+/usr/share/mediawiki/skins/monobook/main.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/main.css
+/usr/share/mediawiki/skins/monobook/IE70Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/IE70Fixes.css
+/usr/share/mediawiki/skins/monobook/Opera6Fixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/Opera6Fixes.css
+/usr/share/mediawiki/skins/monobook/magnify-clip.png /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/magnify-clip.png
+/usr/share/mediawiki/skins/monobook/IEMacFixes.css /var/lib/gforge/plugins/mediawiki/master/skins/fusionforge/IEMacFixes.css

Modified: trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php	2010-04-26 08:52:57 UTC (rev 9602)
+++ trunk/gforge/plugins/mediawiki/bin/mw-drop-wikis.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -21,24 +21,22 @@
    */
 
   /** 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);
 }
 
+include dirname(__FILE__) . '/../../env.inc.php';
+include $gfwww . 'include/squal_pre.php';
+include $gfplugins . 'mediawiki/common/config-vars.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 = "$mediawiki_projects_path/$project";
+  $project_dir = "$projects_path/$project";
   echo "  Deleting project subdir $project_dir.\n";
   if (!is_dir($project_dir)) {
     echo "$project_dir does not exist!\n";

Modified: trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php	2010-04-26 08:52:57 UTC (rev 9602)
+++ trunk/gforge/plugins/mediawiki/bin/mw-plugin-init.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -22,44 +22,44 @@
 
   /** 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;
-}
+include (dirname(__FILE__) . '/../../env.inc.php');
+include ($gfwww.'include/squal_pre.php');
+include ($gfplugins . 'mediawiki/common/config-vars.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 (!isset($mediawiki_master_path))
-	$mediawiki_master_path = "$mediawiki_var_path/master";
+$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($mediawiki_projects_path))
-  system("mkdir -p $mediawiki_projects_path");
-if (!is_dir($mediawiki_master_path))
-  system("mkdir -p $mediawiki_master_path");
+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 $mw_feedback;
-	if (!@symlink($from, $to))
-		$mw_feedback[] = sprintf(_('Could not create symbolic link from %1$s to %1$s'), $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";
+	}
 }
 
-$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);
+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, 
@@ -72,26 +72,24 @@
 		);
 	while ($file = readdir($dh)) {
 		if (!$ignore_file[$file]) {
-			$from = "$mediawiki_src_path/$file";
-			$to = "$mediawiki_master_path/$file";
+			$from = "$src_path/$file";
+			$to = "$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";
+# link LocalSettings.php from $sys_share_path/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
+$from = "$sys_share_path/plugins/mediawiki/www/LocalSettings.php";
+$to = "$master_path/LocalSettings.php";
 mysymlink($from, $to);
 
 # create skin directory
-$todir = "$mediawiki_master_path/skins";
-if (!is_dir($todir))
+$todir = "$master_path/skins";
+if (!is_dir($todir)) {
 	mkdir($todir);
+}
 
 # link FusionForge skin file
 $fromdir = "$sys_share_path/plugins/mediawiki/mediawiki-skin";
@@ -127,17 +125,6 @@
 }
 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"

Modified: trunk/gforge/plugins/mediawiki/bin/mw-wrapper.php
===================================================================
--- trunk/gforge/plugins/mediawiki/bin/mw-wrapper.php	2010-04-26 08:52:57 UTC (rev 9602)
+++ trunk/gforge/plugins/mediawiki/bin/mw-wrapper.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -35,13 +35,13 @@
 $fusionforgeproject = array_shift ($argv) ;
 $mwscript = array_shift ($argv) ;
 
-require (dirname(__FILE__)).'/../../../www/env.inc.php';
-require_once $gfwww.'include/pre.php';
-require_once $gfcommon.'include/cron_utils.php';
+include (dirname(__FILE__)).'/../../env.inc.php';
+include $gfwww.'include/pre.php';
+include $gfcommon.'include/cron_utils.php';
 
 // Plugins subsystem
-require_once $gfcommon.'include/Plugin.class.php' ;
-require_once $gfcommon.'include/PluginManager.class.php' ;
+include $gfcommon.'include/Plugin.class.php' ;
+include $gfcommon.'include/PluginManager.class.php' ;
 
 setup_plugin_manager () ;
 

Modified: trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php	2010-04-26 08:52:57 UTC (rev 9602)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-imagedirs.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -26,13 +26,12 @@
    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');
+include dirname(__FILE__) . '/../../env.inc.php';
+include $gfwww . 'include/squal_pre.php';
+include $gfcommon.'include/cron_utils.php';
+include $gfplugins . 'mediawiki/common/config-vars.php';
 
 if (forge_get_config('enable_uploads', 'mediawiki')) {
-
 	$upload_dir_basename = "images";
 	$projects_path = forge_get_config('projects_path', 'mediawiki');
 
@@ -63,10 +62,10 @@
 		} 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);
+		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!");

Modified: trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php
===================================================================
--- trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php	2010-04-26 08:52:57 UTC (rev 9602)
+++ trunk/gforge/plugins/mediawiki/cronjobs/create-wikis.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -31,10 +31,10 @@
 #   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');
+include dirname(__FILE__) . '/../../env.inc.php';
+include $gfwww . 'include/squal_pre.php';
+include $gfcommon.'include/cron_utils.php';
+include $gfplugins . 'mediawiki/common/config-vars.php';
 
 $src_path = forge_get_config('src_path', 'mediawiki');
 $master_path = forge_get_config('master_path', 'mediawiki');

Deleted: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-04-26 08:52:57 UTC (rev 9602)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -1,279 +0,0 @@
-<?php
-
-require_once('/etc/gforge/local.inc');
-
-if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
-	// when loaded from the server
-        require_once ("$sys_share_path/www/env.inc.php") ;
-	require_once ("$sys_share_path/www/include/pre.php") ;
-} else {
-	// when run from the command line
-        require_once ("$sys_etc_path/database.inc") ;
-	require_once ("$sys_share_path/common/include/config.php") ;
-}
-
-require_once ("$sys_share_path/plugins/mediawiki/common/config-vars.php");
-
-$IP = forge_get_config('master_path', 'mediawiki');
-
-if (!isset ($fusionforgeproject)) {
-	$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 = 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() );
-
-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" );
-        }
-}
-$g = group_get_object_by_name($fusionforgeproject) ;
-$wgSitename         = $g->getPublicName() . " Wiki";
-$wgScriptPath       = "/plugins/mediawiki/wiki/$fusionforgeproject" ;
-
-$wgEmergencyContact = $sys_admin_email;
-$wgPasswordSender = $sys_admin_email;
-
-$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 = forge_get_config('enable_uploads', 'mediawiki');
-$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'] = forge_get_config('plugins_path') ;
-$GLOBALS['sys_urlprefix'] = $sys_urlprefix ;
-$GLOBALS['sys_use_ssl'] = forge_get_config('use_ssl') ;
-$GLOBALS['sys_default_domain'] = forge_get_config('web_host') ;
-$GLOBALS['sys_custom_path'] = forge_get_config('custom_path') ;
-$GLOBALS['gfwww'] = $gfwww ;
-$GLOBALS['gfplugins'] = $gfplugins ;
-$GLOBALS['sys_lang'] = forge_get_config('default_language') ;
-$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);
-		$r =& $u->getRole($g) ;
-
-                $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() ;
-
-                // Role-based access control
-		if (!isset ($r) || !$r || $r->isError()) {
-			$rname = '' ;
-		} else {
-			$rname = "ForgeRole:".$r->getName () ;
-		}
-		$role_groups = preg_grep ("/^ForgeRole:/", $current_groups) ;
-		foreach ($role_groups as $cg) {
-			if ($cg != $rname) {
-                                $user->removeGroup ($cg) ;
-			}
-		}
-		if (!in_array ($rname, $current_groups)) {
-			$user->addGroup ($rname) ;
-		}
-
-		// Previous (group-based) access control
-               $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';
-
-$g = group_get_object_by_name ($fusionforgeproject) ;
-$roles = $g->getRoles () ;
-foreach ($roles as $role) {
-	$gr = "ForgeRole:".$role->getName () ;
-	switch ($role->getVal('plugin_mediawiki_edit', 0)) {
-	case 0:
-		$wgGroupPermissions[$gr]['edit']          = false;
-		$wgGroupPermissions[$gr]['createpage']    = false;
-		$wgGroupPermissions[$gr]['createtalk']    = false;
-		break ;
-	case 1:
-		$wgGroupPermissions[$gr]['edit']          = true;
-		$wgGroupPermissions[$gr]['createpage']    = false;
-		$wgGroupPermissions[$gr]['createtalk']    = false;
-		break ;
-	case 2:
-		$wgGroupPermissions[$gr]['edit']          = true;
-		$wgGroupPermissions[$gr]['createpage']    = true;
-		$wgGroupPermissions[$gr]['createtalk']    = true;
-		break ;
-	}
-}
-
-$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_params("SELECT is_public from groups where unix_group_name=$1", array($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") ;
-} 
-
-// Override default wiki logo
-$wgFavicon = '/images/icon.png' ;
-$wgBreakFrames = false ;
-ini_set ('memory_limit', '50M') ;
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:

Copied: trunk/gforge/plugins/mediawiki/www/LocalSettings.php (from rev 9602, trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php)
===================================================================
--- trunk/gforge/plugins/mediawiki/www/LocalSettings.php	                        (rev 0)
+++ trunk/gforge/plugins/mediawiki/www/LocalSettings.php	2010-04-26 11:29:54 UTC (rev 9603)
@@ -0,0 +1,309 @@
+<?php
+  /* 
+   * Copyright (C) 2010 Roland Mas, 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 contains the local settings for Mediawiki as used in the
+   *  Mediawiki plugin of FusionForge.
+   */
+
+include dirname(__FILE__) . '/../../env.inc.php';
+include $gfcgfile;
+
+if ( isset( $_SERVER ) && 
+     array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+	// when loaded from the server
+	include $gfwww. 'include/pre.php';
+} else {
+	// when run from the command line
+        include $gfconfig . 'database.inc';
+	include $gfcommon .'include/config.php';
+}
+
+include $gfplugins . 'mediawiki/common/config-vars.php';
+
+$IP = forge_get_config('master_path', 'mediawiki');
+
+if (!isset ($fusionforgeproject)) {
+	$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 = 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() );
+
+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" );
+        }
+}
+$g = group_get_object_by_name($fusionforgeproject) ;
+$wgSitename         = $g->getPublicName() . " Wiki";
+$wgScriptPath       = "/plugins/mediawiki/wiki/$fusionforgeproject" ;
+
+$wgEmergencyContact = $sys_admin_email;
+$wgPasswordSender = $sys_admin_email;
+
+$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 = forge_get_config('enable_uploads', 'mediawiki');
+$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'] = forge_get_config('plugins_path') ;
+$GLOBALS['sys_urlprefix'] = $sys_urlprefix ;
+$GLOBALS['sys_use_ssl'] = forge_get_config('use_ssl') ;
+$GLOBALS['sys_default_domain'] = forge_get_config('web_host') ;
+$GLOBALS['sys_custom_path'] = forge_get_config('custom_path') ;
+$GLOBALS['gfwww'] = $gfwww ;
+$GLOBALS['gfplugins'] = $gfplugins ;
+$GLOBALS['sys_lang'] = forge_get_config('default_language') ;
+$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);
+		$r =& $u->getRole($g) ;
+
+                $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() ;
+
+                // Role-based access control
+		if (!isset ($r) || !$r || $r->isError()) {
+			$rname = '' ;
+		} else {
+			$rname = "ForgeRole:".$r->getName () ;
+		}
+		$role_groups = preg_grep ("/^ForgeRole:/", $current_groups) ;
+		foreach ($role_groups as $cg) {
+			if ($cg != $rname) {
+                                $user->removeGroup ($cg) ;
+			}
+		}
+		if (!in_array ($rname, $current_groups)) {
+			$user->addGroup ($rname) ;
+		}
+
+		// Previous (group-based) access control
+               $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 ;
+}
+
+//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';
+
+$g = group_get_object_by_name ($fusionforgeproject) ;
+$roles = $g->getRoles () ;
+foreach ($roles as $role) {
+	$gr = "ForgeRole:".$role->getName () ;
+	switch ($role->getVal('plugin_mediawiki_edit', 0)) {
+	case 0:
+		$wgGroupPermissions[$gr]['edit']          = false;
+		$wgGroupPermissions[$gr]['createpage']    = false;
+		$wgGroupPermissions[$gr]['createtalk']    = false;
+		break ;
+	case 1:
+		$wgGroupPermissions[$gr]['edit']          = true;
+		$wgGroupPermissions[$gr]['createpage']    = false;
+		$wgGroupPermissions[$gr]['createtalk']    = false;
+		break ;
+	case 2:
+		$wgGroupPermissions[$gr]['edit']          = true;
+		$wgGroupPermissions[$gr]['createpage']    = true;
+		$wgGroupPermissions[$gr]['createtalk']    = true;
+		break ;
+	}
+}
+
+$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_params("SELECT is_public from groups where unix_group_name=$1", array($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;
+} 
+
+$wgFavicon = '/images/icon.png' ;
+$wgBreakFrames = false ;
+ini_set ('memory_limit', '50M') ;
+
+// LOAD THE SITE-WIDE AND PROJECT-SPECIFIC EXTRA-SETTINGS 
+if (is_file("$sys_etc_path/plugins/mediawiki/LocalSettings.php")) {
+	include("$sys_etc_path/plugins/mediawiki/LocalSettings.php");
+}
+
+// debian style system-wide mediawiki extensions
+if (is_file("/etc/mediawiki-extensions/extensions.php")) {
+        include( "/etc/mediawiki-extensions/extensions.php" );
+}
+
+// project specific settings
+if (is_file("$project_dir/ProjectSettings.php")) {
+        include ("$project_dir/ProjectSettings.php") ;
+} 
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:




More information about the Fusionforge-commits mailing list