useMessageCache() ) { return wfMsgReal( $key, $args ); } else { return wfMsgReplaceArgs( $fallback, $args ); } } /* If wgShowExceptionDetails, return a HTML message with a backtrace to the error. */ function getHTML() { global $wgShowExceptionDetails; if( $wgShowExceptionDetails ) { return '
' . htmlspecialchars( $this->getMessage() ) . '
Backtrace:
' . nl2br( htmlspecialchars( $this->getTraceAsString() ) ) . "
\n"; } else { return "Set \$wgShowExceptionDetails = true; " . "in LocalSettings.php to show detailed debugging information.
"; } } /* If wgShowExceptionDetails, return a text message with a backtrace to the error */ function getText() { global $wgShowExceptionDetails; if( $wgShowExceptionDetails ) { return $this->getMessage() . "\nBacktrace:\n" . $this->getTraceAsString() . "\n"; } else { return "Set \$wgShowExceptionDetails = true; " . "in LocalSettings.php to show detailed debugging information.
"; } } /* Return titles of this error page */ function getPageTitle() { if ( $this->useMessageCache() ) { return wfMsg( 'internalerror' ); } else { global $wgSitename; return "$wgSitename error"; } } /** Return the requested URL and point to file and line number from which the * exception occured */ function getLogMessage() { global $wgRequest; $file = $this->getFile(); $line = $this->getLine(); $message = $this->getMessage(); return $wgRequest->getRequestURL() . " Exception from line $line of $file: $message"; } /** Output the exception report using HTML */ function reportHTML() { global $wgOut; if ( $this->useOutputPage() ) { $wgOut->setPageTitle( $this->getPageTitle() ); $wgOut->setRobotpolicy( "noindex,nofollow" ); $wgOut->setArticleRelated( false ); $wgOut->enableClientCache( false ); $wgOut->redirect( '' ); $wgOut->clearHTML(); $wgOut->addHTML( $this->getHTML() ); $wgOut->output(); } else { echo $this->htmlHeader(); echo $this->getHTML(); echo $this->htmlFooter(); } } /** Print the exception report using text */ function reportText() { echo $this->getText(); } /* Output a report about the exception and takes care of formatting. * It will be either HTML or plain text based on $wgCommandLineMode. */ function report() { global $wgCommandLineMode; if ( $wgCommandLineMode ) { $this->reportText(); } else { $log = $this->getLogMessage(); if ( $log ) { wfDebugLog( 'exception', $log ); } $this->reportHTML(); } } function htmlHeader() { global $wgLogo, $wgSitename, $wgOutputEncoding; if ( !headers_sent() ) { header( 'HTTP/1.0 500 Internal Server Error' ); header( 'Content-type: text/html; charset='.$wgOutputEncoding ); /* Don't cache error pages! They cause no end of trouble... */ header( 'Cache-control: none' ); header( 'Pragma: nocache' ); } $title = $this->getPageTitle(); echo "