From 1c5386916ef082bb88d40948df38c023f12f8a23 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 8 May 2008 20:04:45 +0000 Subject: [PATCH] * (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 --- RELEASE-NOTES | 3 ++ config/index.php | 58 +++++++++++++++++++++++++++--------- includes/DefaultSettings.php | 3 ++ 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 88ef81e902..e4ae4c3324 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/config/index.php b/config/index.php index 3bf95c11d5..f67b739795 100644 --- a/config/index.php +++ b/config/index.php @@ -603,6 +603,9 @@ print "
  • 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. If upgrading an older installation, leave in backwards-compatible mode.

    - +
    + +
    +
    +

    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.

    + +

    This directory must exist and be writable by the web server.

    +
    + +
    @@ -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; diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 281e51168e..cb4819eb23 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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. -- 2.20.1