summaryrefslogtreecommitdiff
path: root/includes/Exception.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-07-28 11:52:48 +0200
commit222b01f5169f1c7e69762e0e8904c24f78f71882 (patch)
tree8e932e12546bb991357ec48eb1638d1770be7a35 /includes/Exception.php
parent00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff)
update to MediaWiki 1.16.0
Diffstat (limited to 'includes/Exception.php')
-rw-r--r--includes/Exception.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/includes/Exception.php b/includes/Exception.php
index 5f808b20..f6bc6f87 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -8,13 +8,13 @@
* @ingroup Exception
*/
class MWException extends Exception {
-
/**
* Should the exception use $wgOut to output the error ?
* @return bool
*/
function useOutputPage() {
- return !empty( $GLOBALS['wgFullyInitialised'] ) &&
+ return $this->useMessageCache() &&
+ !empty( $GLOBALS['wgFullyInitialised'] ) &&
( !empty( $GLOBALS['wgArticle'] ) || ( !empty( $GLOBALS['wgOut'] ) && !$GLOBALS['wgOut']->isArticle() ) ) &&
!empty( $GLOBALS['wgTitle'] );
}
@@ -25,6 +25,11 @@ class MWException extends Exception {
*/
function useMessageCache() {
global $wgLang;
+ foreach ( $this->getTrace() as $frame ) {
+ if ( isset( $frame['class'] ) && $frame['class'] === 'LocalisationCache' ) {
+ return false;
+ }
+ }
return is_object( $wgLang );
}
@@ -202,7 +207,7 @@ class MWException extends Exception {
header( 'Pragma: nocache' );
}
$title = $this->getPageTitle();
- echo "<html>
+ return "<html>
<head>
<title>$title</title>
</head>
@@ -215,7 +220,7 @@ class MWException extends Exception {
* print the end of the html page if not using $wgOut.
*/
function htmlFooter() {
- echo "</body></html>";
+ return "</body></html>";
}
/**
@@ -297,7 +302,7 @@ function wfReportException( Exception $e ) {
wfPrintError( $message );
} else {
echo nl2br( htmlspecialchars( $message ) ). "\n";
- }
+ }
}
} else {
$message = "Unexpected non-MediaWiki exception encountered, of type \"" . get_class( $e ) . "\"\n" .
@@ -322,8 +327,7 @@ function wfPrintError( $message ) {
# Try to produce meaningful output anyway. Using echo may corrupt output to STDOUT though.
if ( defined( 'STDERR' ) ) {
fwrite( STDERR, $message );
- }
- else {
+ } else {
echo( $message );
}
}