= 2 && is_string( $hook[0] ) ) ) { //'function' or array( 'class', hook' ) $result = call_user_func_array( $hook, $callargs ); } else { $result = null; } if( is_string( $result ) ) return $result; } } /** Get a message from i18n */ function msg( $key, $fallback /*[, params...] */ ) { $args = array_slice( func_get_args(), 2 ); if ( $this->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; " . "at the bottom of 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(); if( $hookResult = $this->runHooks( get_class( $this ) ) ) { $wgOut->addHTML( $hookResult ); } else { $wgOut->addHTML( $this->getHTML() ); } $wgOut->output(); } else { if( $hookResult = $this->runHooks( get_class( $this ) . "Raw" ) ) { die( $hookResult ); } echo $this->htmlHeader(); echo $this->getHTML(); echo $this->htmlFooter(); } } /* 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 ) { fwrite( STDERR, $this->getText() ); } 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 "