r50329 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50328‎ | r50329 | r50330 >
Date:05:51, 8 May 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Backported r50328: bug 17611, SQLite installer user input validation issue
Modified paths:
  • /branches/REL1_15/phase3 (modified) (history)
  • /branches/REL1_15/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_15/phase3/config/index.php (modified) (history)
  • /branches/REL1_15/phase3/includes (modified) (history)
  • /branches/REL1_15/phase3/includes/api (modified) (history)
  • /branches/REL1_15/phase3/includes/specials (modified) (history)

Diff [purge]

Property changes on: branches/REL1_15/phase3/includes/api
___________________________________________________________________
Name: svn:mergeinfo
11 - /trunk/phase3/includes/api:48813-48814,48819,48836,48886,48892,48909,48989,48992,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218
22 + /trunk/phase3/includes/api:48813-48814,48819,48836,48886,48892,48909,48989,48992,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218,50328
Property changes on: branches/REL1_15/phase3/includes/specials
___________________________________________________________________
Name: svn:mergeinfo
33 - /trunk/phase3/includes/specials:48836,48886,48892,48989,48992-48993,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218
/trunk/phase3/includes/specials/specials:48993
44 + /trunk/phase3/includes/specials:48836,48886,48892,48989,48992-48993,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218,50328
/trunk/phase3/includes/specials/specials:48993
Property changes on: branches/REL1_15/phase3/includes
___________________________________________________________________
Name: svn:mergeinfo
55 - /trunk/phase3/includes:48836,48886,48892,48989,48992,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218
/trunk/phase3/includes/specials:48993
66 + /trunk/phase3/includes:48836,48886,48892,48989,48992,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218,50328
/trunk/phase3/includes/specials:48993
Index: branches/REL1_15/phase3/config/index.php
@@ -819,7 +819,9 @@
820820 $wgTitle = Title::newFromText( "Installation script" );
821821 error_reporting( E_ALL );
822822 print "<li>Loading class: " . htmlspecialchars( $dbclass ) . "</li>\n";
823 - $dbc = new $dbclass;
 823+ if ( $conf->DBtype != 'sqlite' ) {
 824+ $dbc = new $dbclass;
 825+ }
824826
825827 if( $conf->DBtype == 'mysql' ) {
826828 $mysqlOldClient = version_compare( mysql_get_client_info(), "4.1.0", "lt" );
@@ -903,7 +905,46 @@
904906 $myver = $wgDatabase->getServerVersion();
905907 }
906908 if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
907 -
 909+
 910+ } elseif ( $conf->DBtype == 'sqlite' ) {
 911+ if ("$wgSQLiteDataDir" == '') {
 912+ $wgSQLiteDataDir = dirname($_SERVER['DOCUMENT_ROOT']).'/data';
 913+ }
 914+ echo "<li>Attempting to connect to SQLite database at \"" .
 915+ htmlspecialchars( $wgSQLiteDataDir ) . "\"";
 916+ if ( !is_dir( $wgSQLiteDataDir ) ) {
 917+ if ( is_writable( dirname( $wgSQLiteDataDir ) ) ) {
 918+ $ok = wfMkdirParents( $wgSQLiteDataDir, $wgSQLiteDataDirMode );
 919+ } else {
 920+ $ok = false;
 921+ }
 922+ if ( !$ok ) {
 923+ echo ": cannot create data directory</li>";
 924+ $errs['SQLiteDataDir'] = 'Enter a valid data directory';
 925+ continue;
 926+ }
 927+ }
 928+ if ( !is_writable( $wgSQLiteDataDir ) ) {
 929+ echo ": data directory not writable</li>";
 930+ $errs['SQLiteDataDir'] = 'Enter a writable data directory';
 931+ continue;
 932+ }
 933+ $dataFile = "$wgSQLiteDataDir/$wgDBname.sqlite";
 934+ if ( file_exists( $dataFile ) && !is_writable( $dataFile ) ) {
 935+ echo ": data file not writable</li>";
 936+ $errs['SQLiteDataDir'] = "$wgDBname.sqlite is not writable";
 937+ continue;
 938+ }
 939+ $wgDatabase = new DatabaseSqlite( false, false, false, $wgDBname, 1 );
 940+ if (!$wgDatabase->isOpen()) {
 941+ print ": error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n";
 942+ $errs['SQLiteDataDir'] = 'Could not connect to database';
 943+ continue;
 944+ } else {
 945+ $myver = $wgDatabase->getServerVersion();
 946+ }
 947+ if (is_callable(array($wgDatabase, 'initial_setup'))) $wgDatabase->initial_setup('', $wgDBname);
 948+ echo "ok</li>\n";
908949 } else { # not mysql
909950 error_reporting( E_ALL );
910951 $wgSuperUser = '';
Index: branches/REL1_15/phase3/RELEASE-NOTES
@@ -343,6 +343,8 @@
344344 * (bug 18601) generator=backlinks returns invalid continue parameter
345345 * (bug 18597) Internal error with empty generator= parameter
346346 * (bug 18617) Add xml:space="preserve" attribute to relevant tags in XML output
 347+* (bug 17611) Provide a sensible error message on install when the SQLite data
 348+ directory is wrong.
347349
348350 === Languages updated in 1.15 ===
349351
Property changes on: branches/REL1_15/phase3
___________________________________________________________________
Name: svn:mergeinfo
350352 - /trunk/phase3:48814,48836,48886,48892,48909,48989,48992,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218
351353 + /trunk/phase3:48814,48836,48886,48892,48909,48989,48992,49002,49051,49068,49086,49191-49192,49212,49682,49685,49730,49775,49954,49956,49999,50041,50054,50070,50132,50134,50169,50215,50218,50328

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50328(bug 17611) Provide a sensible error message on install when the SQLite data ...tstarling05:43, 8 May 2009

Status & tagging log