Index: branches/REL1_16/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -978,14 +978,19 @@ |
979 | 979 | function setup_database() { |
980 | 980 | global $wgVersion, $wgDBmwschema, $wgDBts2schema, $wgDBport, $wgDBuser; |
981 | 981 | |
982 | | - echo "<li>Creating DB objects</li>\n"; |
983 | 982 | $res = $this->sourceFile( "../maintenance/ora/tables.sql" ); |
| 983 | + if ($res === true) { |
| 984 | + print " done.</li>\n"; |
| 985 | + } else { |
| 986 | + print " <b>FAILED</b></li>\n"; |
| 987 | + dieout( htmlspecialchars( $res ) ); |
| 988 | + } |
984 | 989 | |
985 | 990 | // Avoid the non-standard "REPLACE INTO" syntax |
986 | | - echo "<li>Populating table interwiki</li>\n"; |
| 991 | + echo "<li>Populating interwiki table</li>\n"; |
987 | 992 | $f = fopen( "../maintenance/interwiki.sql", 'r' ); |
988 | 993 | if ( $f == false ) { |
989 | | - dieout( "<li>Could not find the interwiki.sql file</li>" ); |
| 994 | + dieout( "Could not find the interwiki.sql file" ); |
990 | 995 | } |
991 | 996 | |
992 | 997 | // do it like the postgres :D |
Index: branches/REL1_16/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -1311,11 +1311,17 @@ |
1312 | 1312 | if (!$res) { |
1313 | 1313 | print "<b>FAILED</b>. Make sure that the user \"" . htmlspecialchars( $wgDBuser ) . |
1314 | 1314 | "\" can write to the schema \"" . htmlspecialchars( $wgDBmwschema ) . "\"</li>\n"; |
1315 | | - dieout("</ul>"); |
| 1315 | + dieout(""); # Will close the main list <ul> and finish the page. |
1316 | 1316 | } |
1317 | 1317 | $this->doQuery("DROP TABLE $safeschema.$ctest"); |
1318 | 1318 | |
1319 | 1319 | $res = $this->sourceFile( "../maintenance/postgres/tables.sql" ); |
| 1320 | + if ($res === true) { |
| 1321 | + print " done.</li>\n"; |
| 1322 | + } else { |
| 1323 | + print " <b>FAILED</b></li>\n"; |
| 1324 | + dieout( htmlspecialchars( $res ) ); |
| 1325 | + } |
1320 | 1326 | |
1321 | 1327 | ## Update version information |
1322 | 1328 | $mwv = $this->addQuotes($wgVersion); |
— | — | @@ -1333,10 +1339,13 @@ |
1334 | 1340 | "WHERE type = 'Creation'"; |
1335 | 1341 | $this->query($SQL); |
1336 | 1342 | |
| 1343 | + echo "<li>Populating interwiki table... "; |
| 1344 | + |
1337 | 1345 | ## Avoid the non-standard "REPLACE INTO" syntax |
1338 | 1346 | $f = fopen( "../maintenance/interwiki.sql", 'r' ); |
1339 | 1347 | if ($f == false ) { |
1340 | | - dieout( "<li>Could not find the interwiki.sql file"); |
| 1348 | + print "<b>FAILED</b></li>"; |
| 1349 | + dieout( "Could not find the interwiki.sql file" ); |
1341 | 1350 | } |
1342 | 1351 | ## We simply assume it is already empty as we have just created it |
1343 | 1352 | $SQL = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES "; |
— | — | @@ -1348,7 +1357,7 @@ |
1349 | 1358 | } |
1350 | 1359 | $this->query("$SQL $matches[1],$matches[2])"); |
1351 | 1360 | } |
1352 | | - print " (table interwiki successfully populated)...\n"; |
| 1361 | + print " successfully populated.</li>\n"; |
1353 | 1362 | |
1354 | 1363 | $this->doQuery("COMMIT"); |
1355 | 1364 | } |
Index: branches/REL1_16/phase3/includes/db/DatabaseIbm_db2.php |
— | — | @@ -746,6 +746,11 @@ |
747 | 747 | $this->begin(); |
748 | 748 | |
749 | 749 | $res = $this->sourceFile( "../maintenance/ibm_db2/tables.sql" ); |
| 750 | + if ($res !== true) { |
| 751 | + print " <b>FAILED</b>: " . htmlspecialchars( $res ) . "</li>"; |
| 752 | + } else { |
| 753 | + print " done</li>"; |
| 754 | + } |
750 | 755 | $res = null; |
751 | 756 | |
752 | 757 | // TODO: update mediawiki_version table |
Index: branches/REL1_16/phase3/includes/db/Database.php |
— | — | @@ -2165,9 +2165,23 @@ |
2166 | 2166 | function sourceFile( $filename, $lineCallback = false, $resultCallback = false ) { |
2167 | 2167 | $fp = fopen( $filename, 'r' ); |
2168 | 2168 | if ( false === $fp ) { |
2169 | | - throw new MWException( "Could not open \"{$filename}\".\n" ); |
| 2169 | + if (!defined("MEDIAWIKI_INSTALL")) |
| 2170 | + throw new MWException( "Could not open \"{$filename}\".\n" ); |
| 2171 | + else |
| 2172 | + return "Could not open \"{$filename}\".\n"; |
2170 | 2173 | } |
2171 | | - $error = $this->sourceStream( $fp, $lineCallback, $resultCallback ); |
| 2174 | + try { |
| 2175 | + $error = $this->sourceStream( $fp, $lineCallback, $resultCallback ); |
| 2176 | + } |
| 2177 | + catch( MWException $e ) { |
| 2178 | + if ( defined("MEDIAWIKI_INSTALL") ) { |
| 2179 | + $error = $e->getMessage(); |
| 2180 | + } else { |
| 2181 | + fclose( $fp ); |
| 2182 | + throw $e; |
| 2183 | + } |
| 2184 | + } |
| 2185 | + |
2172 | 2186 | fclose( $fp ); |
2173 | 2187 | return $error; |
2174 | 2188 | } |
Index: branches/REL1_16/phase3/includes/db/DatabaseSqlite.php |
— | — | @@ -487,13 +487,17 @@ |
488 | 488 | # Process common MySQL/SQLite table definitions |
489 | 489 | $err = $this->sourceFile( "$IP/maintenance/tables.sql" ); |
490 | 490 | if ( $err !== true ) { |
491 | | - $this->reportQueryError( $err, 0, $sql, __FUNCTION__ ); |
492 | | - exit( 1 ); |
| 491 | + echo " <b>FAILED</b></li>"; |
| 492 | + dieout( htmlspecialchars( $err ) ); |
493 | 493 | } |
| 494 | + echo " done.</li>"; |
494 | 495 | |
495 | 496 | # Use DatabasePostgres's code to populate interwiki from MySQL template |
496 | 497 | $f = fopen( "$IP/maintenance/interwiki.sql", 'r' ); |
497 | | - if ( $f == false ) dieout( "<li>Could not find the interwiki.sql file" ); |
| 498 | + if ( $f == false ) { |
| 499 | + dieout( "Could not find the interwiki.sql file." ); |
| 500 | + } |
| 501 | + |
498 | 502 | $sql = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES "; |
499 | 503 | while ( !feof( $f ) ) { |
500 | 504 | $line = fgets( $f, 1024 ); |
Index: branches/REL1_16/phase3/config/Installer.php |
— | — | @@ -1020,7 +1020,8 @@ |
1021 | 1021 | if ($wgDatabase->isOpen()) { |
1022 | 1022 | $wgDBOracleDefTS = $conf->DBdefTS_ora; |
1023 | 1023 | $wgDBOracleTempTS = $conf->DBtempTS_ora; |
1024 | | - $wgDatabase->sourceFile( "../maintenance/ora/user.sql" ); |
| 1024 | + $res = $wgDatabase->sourceFile( "../maintenance/ora/user.sql" ); |
| 1025 | + if ($res !== true) dieout($res); |
1025 | 1026 | } else { |
1026 | 1027 | echo "<li>Invalid database superuser, please supply a valid superuser account.</li>"; |
1027 | 1028 | echo "<li>ERR: ".print_r(oci_error(), true)."</li>"; |
— | — | @@ -1197,7 +1198,8 @@ |
1198 | 1199 | print " <b class='error'>If the next step fails, see <a href='http://dev.mysql.com/doc/mysql/en/old-client.html'>http://dev.mysql.com/doc/mysql/en/old-client.html</a> for help.</b>"; |
1199 | 1200 | } |
1200 | 1201 | print "</li>\n"; |
1201 | | - $wgDatabase->sourceFile( "../maintenance/users.sql" ); |
| 1202 | + $res = $wgDatabase->sourceFile( "../maintenance/users.sql" ); |
| 1203 | + if ($res !== true) dieout($res); |
1202 | 1204 | } |
1203 | 1205 | } |
1204 | 1206 | } |
— | — | @@ -1232,8 +1234,17 @@ |
1233 | 1235 | # FIXME: Check for errors |
1234 | 1236 | print "<li>Creating tables..."; |
1235 | 1237 | if ($conf->DBtype == 'mysql') { |
1236 | | - $wgDatabase->sourceFile( "../maintenance/tables.sql" ); |
1237 | | - $wgDatabase->sourceFile( "../maintenance/interwiki.sql" ); |
| 1238 | + $res = $wgDatabase->sourceFile( "../maintenance/tables.sql" ); |
| 1239 | + if ($res === true) { |
| 1240 | + print " done.</li>\n<li>Populating interwiki table... \n"; |
| 1241 | + $res = $wgDatabase->sourceFile( "../maintenance/interwiki.sql" ); |
| 1242 | + } |
| 1243 | + if ($res === true) { |
| 1244 | + print " done.</li>\n"; |
| 1245 | + } else { |
| 1246 | + print " <b>FAILED</b></li>\n"; |
| 1247 | + dieout( htmlspecialchars( $res ) ); |
| 1248 | + } |
1238 | 1249 | } elseif (is_callable(array($wgDatabase, 'setup_database'))) { |
1239 | 1250 | $wgDatabase->setup_database(); |
1240 | 1251 | } |
— | — | @@ -1242,9 +1253,7 @@ |
1243 | 1254 | continue; |
1244 | 1255 | } |
1245 | 1256 | |
1246 | | - print " done.</li>\n"; |
1247 | 1257 | |
1248 | | - |
1249 | 1258 | if ( $conf->DBtype == 'ibm_db2' ) { |
1250 | 1259 | // Now that table creation is done, make sure everything is committed |
1251 | 1260 | // Do this before doing inserts through API |
— | — | @@ -1284,8 +1293,13 @@ |
1285 | 1294 | } else { |
1286 | 1295 | # Yes, so run the grants |
1287 | 1296 | echo( "<li>" . htmlspecialchars( "Granting user permissions to $wgDBuser on $wgDBname..." ) ); |
1288 | | - $wgDatabase->sourceFile( "../maintenance/users.sql" ); |
1289 | | - echo( "success.</li>\n" ); |
| 1297 | + $res = $wgDatabase->sourceFile( "../maintenance/users.sql" ); |
| 1298 | + if ( $res === true ) { |
| 1299 | + echo( " success.</li>\n" ); |
| 1300 | + } else { |
| 1301 | + echo( " <b>FAILED</b>.</li>\n" ); |
| 1302 | + dieout( $res ); |
| 1303 | + } |
1290 | 1304 | } |
1291 | 1305 | } |
1292 | 1306 | |
Index: branches/REL1_16/phase3/RELEASE-NOTES |
— | — | @@ -55,6 +55,7 @@ |
56 | 56 | in page views and previews when the language converter is enabled. |
57 | 57 | * (bug 23148) Fixed a local path disclosure vulnerability in ImageMagick image |
58 | 58 | scaling, which was introduced in 1.16 beta 1. |
| 59 | +* Improved error checking on installer. |
59 | 60 | |
60 | 61 | === Changes since 1.16 beta 1 === |
61 | 62 | |