* (bug 14047) Fix regression in installer which hid DB-specific options.
authorBrion Vibber <brion@users.mediawiki.org>
Thu, 8 May 2008 20:04:45 +0000 (20:04 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Thu, 8 May 2008 20:04:45 +0000 (20:04 +0000)
  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

RELEASE-NOTES
config/index.php
includes/DefaultSettings.php

index 88ef81e..e4ae4c3 100644 (file)
@@ -262,6 +262,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   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 ===
 
index 3bf95c1..f67b739 100644 (file)
@@ -603,6 +603,9 @@ print "<li style='font-weight:bold;color:green;font-size:110%'>Environment check
        $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 @@ if( count( $errs ) ) {
                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 @@ if( count( $errs ) ) {
        </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 @@ function writeLocalSettings( $conf ) {
                $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,19 +1679,7 @@ if ( \$wgCommandLineMode ) {
 \$wgDBuser           = \"{$slconf['DBuser']}\";
 \$wgDBpassword       = \"{$slconf['DBpassword']}\";
 
-# 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};
-
-# Postgres specific settings
-\$wgDBport           = \"{$slconf['DBport']}\";
-\$wgDBmwschema       = \"{$slconf['DBmwschema']}\";
-\$wgDBts2schema      = \"{$slconf['DBts2schema']}\";
+{$dbsettings}
 
 ## Shared memory settings
 \$wgMainCacheType = $cacheType;
index 281e511..cb4819e 100644 (file)
@@ -564,6 +564,9 @@ $wgDBprefix         = '';
 /** 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.