Last modified: 2006-01-06 21:47:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 4509 - Feature Request: Distinct LocalSettings.php for virtual websites
Feature Request: Distinct LocalSettings.php for virtual websites
Status: RESOLVED DUPLICATE of bug 4505
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
unspecified
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-06 21:32 UTC by Jeff Armstrong
Modified: 2006-01-06 21:47 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Support Virtual Wikis (6.09 KB, patch)
2006-01-06 21:34 UTC, Jeff Armstrong
Details

Description Jeff Armstrong 2006-01-06 21:32:04 UTC
I have MediaWiki installed on a webserver one, and want to have multiple Wikis,
each in their own database, with their own users and administrators etc. I have
the Apache virtual sites, and DNS all configured. MediaWiki only supports a
single LocalSettings.php.

I would like to in Apache say <Virtual >SetEnv MEDIAWIKI myname </Virtual> and
have MediaWiki look for myname.LocalSettings.php. config/index should also
create the correctly named settings file.

Here is a patch that does what I want:
<pre>
--- mediawiki-1.5.5/config/index.php	2006-01-06 21:17:44.000000000 +0000
+++ mediawiki-1.5.5.orig/config/index.php	2005-10-28 10:02:36.000000000 +0100
@@ -132,31 +132,15 @@
 
 /* Check for existing configurations and bug out! */
 
-# Enable SetEnv override of LocalSettings.php name: virtual Wikis!
-# in Apache, you can SetEnv MEDIAWIKI mywiki and have different
-# LocalSettings.php for each named site
-$wgSiteName = getenv("MEDIAWIKI");
-if ( $wgSiteName ) {
-  $wgLocalSettings = "$wgSiteName.LocalSettings.php";
-} else {
-  $wgLocalSettings = "LocalSettings.php";
-}
-
-# Fail safely if SetEnv is invalid...
-if( !file_exists( "../$wgLocalSettings" ) && file_exists(
"../LocalSettings.php" ) ) {
-  $wgLocalSettings = 'LocalSettings.php';
-}
-
-
-if( file_exists( "../$wgLocalSettings" ) ) {
+if( file_exists( "../LocalSettings.php" ) ) {
 	dieout( "<h2>Wiki is configured.</h2>
 
-	<p>Already configured... ($wgLocalSettings) <a href='../index.php'>return to
the wiki</a>.</p>
+	<p>Already configured... <a href='../index.php'>return to the wiki</a>.</p>
 
 	<p>(You should probably remove this directory for added security.)</p>" );
 }
 
-if( file_exists( "./$wgLocalSettings" ) ) {
+if( file_exists( "./LocalSettings.php" ) ) {
 	writeSuccessMessage();
 
 	dieout( '' );
@@ -276,7 +260,7 @@
 	$conf->prettyURLs = false;
 	break;
 default:
-	print "unknown; using pretty URLs (<tt>index.php/Page_Title</tt>), if you have
trouble change this in <tt>$wgLocalSettings</tt>";
+	print "unknown; using pretty URLs (<tt>index.php/Page_Title</tt>), if you have
trouble change this in <tt>LocalSettings.php</tt>";
 }
 print "</li>\n";
 
@@ -690,7 +674,7 @@
 		}
 
 		/* Write out the config file now that all is well */
-		print "<p>Creating $wgLocalSettings...</p>\n\n";
+		print "<p>Creating LocalSettings.php...</p>\n\n";
 		$localSettings =  "<" . "?php$endl$local$endl?" . ">";
 		// Fix up a common line-ending problem (due to CVS on Windows)
 		$localSettings = str_replace( "\r\n", "\n", $localSettings );
@@ -700,10 +684,10 @@
 		} else {
 			$xt = "wt"; # 'x' is not available prior to PHP 4.3.2. We did check above,
but race conditions blah blah
 		}
-		$f = fopen( $wgLocalSettings, $xt );
+		$f = fopen( "LocalSettings.php", $xt );
 
 		if( $f == false ) {
-			dieout( "<p>Couldn't write out $wgLocalSettings. Check that the directory
permissions are correct and that there isn't already a file of that name
here...</p>\n" .
+			dieout( "<p>Couldn't write out LocalSettings.php. Check that the directory
permissions are correct and that there isn't already a file of that name
here...</p>\n" .
 			"<p>Here's the file that would have been written, try to paste it into place
manually:</p>\n" .
 			"<pre>\n" . htmlspecialchars( $localSettings ) . "</pre>\n" );
 		}
@@ -712,7 +696,7 @@
 			writeSuccessMessage();
 		} else {
 			fclose( $f );
-			die("<p class='error'>An error occured while writing the
config/$wgLocalSettings file. Check user rights and disk space then try
again.</p>\n");
+			die("<p class='error'>An error occured while writing the
config/LocalSettings.php file. Check user rights and disk space then try
again.</p>\n");
 
 		}
 
@@ -975,7 +959,7 @@
 
 		<p>Avoid exotic characters; something like <tt>mw_</tt> is good.</p>
 	</dt>
-
+	
 	<dd><label class="column">Database charset</label>
 		<div>Select one:</div>
 		<ul class="plain">
@@ -1023,18 +1007,18 @@
 <p>Installation successful!</p>
 <p>To complete the installation, please do the following:
 <ol>
-	<li>Download config/$wgLocalSettings with your FTP client or file manager</li>
+	<li>Download config/LocalSettings.php with your FTP client or file manager</li>
 	<li>Upload it to the parent directory</li>
-	<li>Delete config/$wgLocalSettings</li>
+	<li>Delete config/LocalSettings.php</li>
 	<li>Start using <a href='../index.php'>your wiki</a>!
 </ol>
-<p>If you are in a shared hosting environment, do <strong>not</strong> just
move $wgLocalSettings
-remotely. $wgLocalSettings is currently owned by the user your webserver is
running under,
+<p>If you are in a shared hosting environment, do <strong>not</strong> just
move LocalSettings.php
+remotely. LocalSettings.php is currently owned by the user your webserver is
running under,
 which means that anyone on the same server can read your database password!
Downloading
 it and uploading it again will hopefully change the ownership to a user ID
specific to you.</p>
 EOT;
 	} else {
-		echo "<p>Installation successful! Move the config/$wgLocalSettings file into
the parent directory, then follow
+		echo "<p>Installation successful! Move the config/LocalSettings.php file into
the parent directory, then follow
 			<a href='../index.php'>this link</a> to your wiki.</p>\n";
 	}
 }
@@ -1125,7 +1109,6 @@
 
 	$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":";
 	$localsettings = "
-# $wgLocalSettings
 # This file was automatically generated by the MediaWiki installer.
 # If you make manual changes, please keep track in case you need to
 # recreate them later.
Only in mediawiki-1.5.5: debian
diff -ur mediawiki-1.5.5/index.php mediawiki-1.5.5.orig/index.php
--- mediawiki-1.5.5/index.php	2006-01-06 21:11:15.000000000 +0000
+++ mediawiki-1.5.5.orig/index.php	2005-11-16 21:29:24.000000000 +0000
@@ -16,22 +16,7 @@
 define( 'MEDIAWIKI', true );
 require_once( './includes/Defines.php' );
 
-# Enable SetEnv override of LocalSettings.php name: virtual Wikis!
-# in Apache, you can SetEnv MEDIAWIKI mywiki and have different
-# LocalSettings.php for each named site
-$wgSiteName = getenv("MEDIAWIKI");
-if ( $wgSiteName ) {
-  $wgLocalSettings = "./$wgSiteName.LocalSettings.php";
-} else {
-  $wgLocalSettings = "./LocalSettings.php";
-}
-
-# Fail safely if SetEnv is invalid...
-if( !file_exists( $wgLocalSettings ) && file_exists( './LocalSettings.php') ) {
-  $wgLocalSettings = './LocalSettings.php';
-}
-
-if( !file_exists( $wgLocalSettings ) ) {
+if( !file_exists( 'LocalSettings.php' ) ) {
 	$IP = "." ;
 	require_once( 'includes/DefaultSettings.php' ); # used for printing the version
 ?>
@@ -74,7 +59,7 @@
 	die();
 }
 
-require_once( $wgLocalSettings );
+require_once( './LocalSettings.php' );
 require_once( 'includes/Setup.php' );
 
 wfProfileIn( 'main-misc-setup' );

</pre>
Comment 1 Jeff Armstrong 2006-01-06 21:34:07 UTC
Created attachment 1269 [details]
Support Virtual Wikis
Comment 2 Brion Vibber 2006-01-06 21:47:06 UTC

*** This bug has been marked as a duplicate of 4505 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links