Index: trunk/phase3/includes/Exception.php |
— | — | @@ -187,12 +187,8 @@ |
188 | 188 | die( $hookResult ); |
189 | 189 | } |
190 | 190 | |
191 | | - $html = $this->getHTML(); |
192 | | - if ( defined( 'MEDIAWIKI_INSTALL' ) ) { |
193 | | - echo $html; |
194 | | - } else { |
195 | | - wfDie( $html ); |
196 | | - } |
| 191 | + echo $this->getHTML(); |
| 192 | + die(1); |
197 | 193 | } |
198 | 194 | } |
199 | 195 | |
— | — | @@ -215,7 +211,7 @@ |
216 | 212 | } |
217 | 213 | |
218 | 214 | static function isCommandLine() { |
219 | | - return !empty( $GLOBALS['wgCommandLineMode'] ) && !defined( 'MEDIAWIKI_INSTALL' ); |
| 215 | + return !empty( $GLOBALS['wgCommandLineMode'] ); |
220 | 216 | } |
221 | 217 | } |
222 | 218 | |
— | — | @@ -431,7 +427,7 @@ |
432 | 428 | if ( $cmdLine ) { |
433 | 429 | self::printError( $message ); |
434 | 430 | } else { |
435 | | - wfDie( nl2br( htmlspecialchars( $message ) ) ) . "\n"; |
| 431 | + self::escapeEchoAndDie( $message ); |
436 | 432 | } |
437 | 433 | } |
438 | 434 | } else { |
— | — | @@ -445,7 +441,7 @@ |
446 | 442 | if ( $cmdLine ) { |
447 | 443 | self::printError( $message ); |
448 | 444 | } else { |
449 | | - wfDie( nl2br( htmlspecialchars( $message ) ) ) . "\n"; |
| 445 | + self::escapeEchoAndDie( $message ); |
450 | 446 | } |
451 | 447 | } |
452 | 448 | } |
— | — | @@ -453,6 +449,7 @@ |
454 | 450 | /** |
455 | 451 | * Print a message, if possible to STDERR. |
456 | 452 | * Use this in command line mode only (see isCommandLine) |
| 453 | + * @param $message String Failure text |
457 | 454 | */ |
458 | 455 | public static function printError( $message ) { |
459 | 456 | # NOTE: STDERR may not be available, especially if php-cgi is used from the command line (bug #15602). |
— | — | @@ -465,6 +462,16 @@ |
466 | 463 | } |
467 | 464 | |
468 | 465 | /** |
| 466 | + * Print a message after escaping it and converting newlines to <br> |
| 467 | + * Use this for non-command line failures |
| 468 | + * @param $message String Failure text |
| 469 | + */ |
| 470 | + private static function escapeEchoAndDie( $message ) { |
| 471 | + echo nl2br( htmlspecialchars( $message ) ) . "\n"; |
| 472 | + die(1); |
| 473 | + } |
| 474 | + |
| 475 | + /** |
469 | 476 | * Exception handler which simulates the appropriate catch() handling: |
470 | 477 | * |
471 | 478 | * try { |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3350,7 +3350,7 @@ |
3351 | 3351 | function wfOut( $s ) { |
3352 | 3352 | wfDeprecated( __METHOD__ ); |
3353 | 3353 | global $wgCommandLineMode; |
3354 | | - if ( $wgCommandLineMode && !defined( 'MEDIAWIKI_INSTALL' ) ) { |
| 3354 | + if ( $wgCommandLineMode ) { |
3355 | 3355 | echo $s; |
3356 | 3356 | } else { |
3357 | 3357 | echo htmlspecialchars( $s ); |