MediaWiki r34457 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r34456‎ | r34457 (on ViewVC)‎ | r34458 >
Date:20:04, 8 May 2008
Author:brion
Status:old
Tags:
Comment:
* (bug 14047) Fix regression in installer which hid DB-specific options.
Also makes SQLite path configurable in the installer.

$wgSQLiteDataDir wasn't being initialized in DefaultSettings.php, potentially open to register_globals attacks. Now initialized to '', which gets interpreted as default.

Now adding only the options for the relevant DB to the generated LocalSettings.php
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 34456)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 34457)
@@ -564,6 +564,9 @@
 /** MySQL table options to use during installation or update */
 $wgDBTableOptions = 'TYPE=InnoDB';
 
+/** To override default SQLite data directory ($docroot/../data) */
+$wgSQLiteDataDir = '';
+
 /**
  * Make all database connections secretly go to localhost. Fool the load balancer
  * thinking there is an arbitrarily large cluster of servers to connect to.
Index: trunk/phase3/config/index.php
===================================================================
--- trunk/phase3/config/index.php	(revision 34456)
+++ trunk/phase3/config/index.php	(revision 34457)
@@ -603,6 +603,9 @@
 	$conf->DBport      = importPost( "DBport",      "5432" );
 	$conf->DBmwschema  = importPost( "DBmwschema",  "mediawiki" );
 	$conf->DBts2schema = importPost( "DBts2schema", "public" );
+	
+	## SQLite specific
+	$conf->SQLiteDataDir = importPost( "SQLiteDataDir", "" );
 
 /* Check for validity */
 $errs = array();
@@ -1413,7 +1416,7 @@
 		cause things to break. <b>If upgrading an older installation, leave
 		in backwards-compatible mode.</b>
 	</p>
-	</div>
+	</fieldset>
 
 	<?php database_switcher('postgres'); ?>
 	<div class="config-input"><?php
@@ -1432,6 +1435,19 @@
 	</div>
 	</fieldset>
 
+	<?php database_switcher('sqlite'); ?>
+	<div class="config-input"><?php
+		aField( $conf, "SQLiteDataDir", "SQLite data directory:" );
+	?></div>
+	<div class="config-desc">
+		<p>SQLite stores table data into files in the filesystem.
+		If you do not provide an explicit path, a "data" directory in
+		the parent of your document root will be used.</p>
+		
+		<p>This directory must exist and be writable by the web server.</p>
+	</div>
+	</fieldset>
+
 	<div class="config-input" style="padding:2em 0 3em">
 		<label class='column'>&nbsp;</label>
 		<input type="submit" value="Install MediaWiki!" class="btn-install" />
@@ -1574,6 +1590,32 @@
 		$slconf['RightsIcon'] = $conf->RightsIcon;
 	}
 
+	if( $conf->DBtype == 'mysql' ) {
+		$dbsettings =
+"# MySQL specific settings
+\$wgDBprefix         = \"{$slconf['DBprefix']}\";
+
+# MySQL table options to use during installation or update
+\$wgDBTableOptions   = \"{$slconf['DBTableOptions']}\";
+
+# Experimental charset support for MySQL 4.1/5.0.
+\$wgDBmysql5 = {$conf->DBmysql5};";
+	} elseif( $conf->DBtype == 'postgres' ) {
+		$dbsettings =
+"# Postgres specific settings
+\$wgDBport           = \"{$slconf['DBport']}\";
+\$wgDBmwschema       = \"{$slconf['DBmwschema']}\";
+\$wgDBts2schema      = \"{$slconf['DBts2schema']}\";";
+	} elseif( $conf->DBtype == 'sqlite' ) {
+		$dbsettings =
+"# SQLite-specific settings
+\$wgSQLiteDataDir    = \"{$slconf['SQLiteDataDir']}\";";
+	} else {
+		// ummm... :D
+		$dbsettings = '';
+	}
+
+
 	$localsettings = "
 # This file was automatically generated by the MediaWiki installer.
 # If you make manual changes, please keep track in case you need to
@@ -1637,20 +1679,8 @@
 \$wgDBuser           = \"{$slconf['DBuser']}\";
 \$wgDBpassword       = \"{$slconf['DBpassword']}\";
 
-# MySQL specific settings
-\$wgDBprefix         = \"{$slconf['DBprefix']}\";
+{$dbsettings}
 
-# MySQL table options to use during installation or update
-\$wgDBTableOptions   = \"{$slconf['DBTableOptions']}\";
-
-# Experimental charset support for MySQL 4.1/5.0.
-\$wgDBmysql5 = {$conf->DBmysql5};
-
-# Postgres specific settings
-\$wgDBport           = \"{$slconf['DBport']}\";
-\$wgDBmwschema       = \"{$slconf['DBmwschema']}\";
-\$wgDBts2schema      = \"{$slconf['DBts2schema']}\";
-
 ## Shared memory settings
 \$wgMainCacheType = $cacheType;
 \$wgMemCachedServers = $mcservers;
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 34456)
+++ trunk/phase3/RELEASE-NOTES	(revision 34457)
@@ -262,7 +262,10 @@
   Note that case mappings will only be used if mbstring extension is not present.
 * (bug 14044) Don't increment page view counters on views from bot users
 * (bug 14042) Calling Database::limitResult() misplaced the comment in the log file
+* (bug 14047) Fix regression in installer which hid DB-specific options.
+  Also makes SQLite path configurable in the installer.
 
+
 === API changes in 1.13 ===
 
 * Fixing main page display in meta=siteinfo

Status & tagging log

  • 15:26, 12 September 2011 Meno25 (Talk | contribs) changed the status of r34457 [removed: ok added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox