die( $hookResult );
}
- $html = $this->getHTML();
- if ( defined( 'MEDIAWIKI_INSTALL' ) ) {
- echo $html;
- } else {
- wfDie( $html );
- }
+ echo $this->getHTML();
+ die(1);
}
}
}
static function isCommandLine() {
- return !empty( $GLOBALS['wgCommandLineMode'] ) && !defined( 'MEDIAWIKI_INSTALL' );
+ return !empty( $GLOBALS['wgCommandLineMode'] );
}
}
if ( $cmdLine ) {
self::printError( $message );
} else {
- wfDie( nl2br( htmlspecialchars( $message ) ) ) . "\n";
+ self::escapeEchoAndDie( $message );
}
}
} else {
if ( $cmdLine ) {
self::printError( $message );
} else {
- wfDie( nl2br( htmlspecialchars( $message ) ) ) . "\n";
+ self::escapeEchoAndDie( $message );
}
}
}
/**
* Print a message, if possible to STDERR.
* Use this in command line mode only (see isCommandLine)
+ * @param $message String Failure text
*/
public static function printError( $message ) {
# NOTE: STDERR may not be available, especially if php-cgi is used from the command line (bug #15602).
}
}
+ /**
+ * Print a message after escaping it and converting newlines to <br>
+ * Use this for non-command line failures
+ * @param $message String Failure text
+ */
+ private static function escapeEchoAndDie( $message ) {
+ echo nl2br( htmlspecialchars( $message ) ) . "\n";
+ die(1);
+ }
+
/**
* Exception handler which simulates the appropriate catch() handling:
*
function wfOut( $s ) {
wfDeprecated( __METHOD__ );
global $wgCommandLineMode;
- if ( $wgCommandLineMode && !defined( 'MEDIAWIKI_INSTALL' ) ) {
+ if ( $wgCommandLineMode ) {
echo $s;
} else {
echo htmlspecialchars( $s );