Go to the documentation of this file.
39 public static function output(
$e, $mode, $eNew =
null ) {
42 if ( defined(
'MW_API' ) ) {
44 self::header(
'MediaWiki-API-Error: internal_api_error_' . get_class(
$e ) );
45 wfHttpError( 500,
'Internal Server Error', self::getText(
$e ) );
46 } elseif ( self::isCommandLine() ) {
48 } elseif ( $mode === self::AS_PRETTY ) {
53 self::header(
"Content-Type: $wgMimeType; charset=utf-8" );
58 $message =
"MediaWiki internal error.\n\n";
59 if ( self::showBackTrace(
$e ) ) {
60 $message .=
'Original exception: ' .
63 "\n\nException caught inside exception handler: " .
67 $message .=
'Original exception: ' .
69 $message .=
"\n\nException caught inside exception handler.\n\n" .
74 if ( self::showBackTrace(
$e ) ) {
82 echo nl2br( htmlspecialchars( $message ) ) .
"\n";
92 foreach (
$e->getTrace()
as $frame ) {
93 if ( isset( $frame[
'class'] ) && $frame[
'class'] ===
'LocalisationCache' ) {
103 !empty(
$GLOBALS[
'wgFullyInitialised'] ) &&
106 !defined(
'MEDIAWIKI_INSTALL' )
118 if ( self::useOutputPage(
$e ) ) {
120 $wgOut->prepareErrorPage(
$e->getPageTitle() );
122 $wgOut->prepareErrorPage( self::msg(
'readonly',
'Database is locked' ) );
124 $wgOut->prepareErrorPage( self::msg(
'databaseerror',
'Database error' ) );
126 $wgOut->prepareErrorPage( self::msg(
'internalerror',
'Internal error' ) );
131 $wgOut->addHTML( Message::newFromSpecifier(
$e )->escaped() );
133 $wgOut->addHTML( self::getHTML(
$e ) );
137 self::header(
'Content-Type: text/html; charset=utf-8' );
138 $pageTitle =
self::msg(
'internalerror',
'Internal error' );
139 echo
"<!DOCTYPE html>\n" .
143 htmlspecialchars( self::msg(
'pagetitle',
"$1 - $wgSitename", $pageTitle ) ) .
145 '<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
150 echo
"</body></html>\n";
163 if ( self::showBackTrace(
$e ) ) {
164 $html =
"<div class=\"errorbox mw-content-ltr\"><p>" .
166 '</p><p>Backtrace:</p><p>' .
171 $html =
"<div class=\"errorbox mw-content-ltr\">" .
173 '[' . $logId .
'] ' .
174 gmdate(
'Y-m-d H:i:s' ) .
": " .
175 self::msg(
"internalerror-fatal-exception",
176 "Fatal exception of type $1",
182 "<!-- " . wordwrap( self::getShowBacktraceError(
$e ), 50 ) .
" -->";
198 $args = array_slice( func_get_args(), 2 );
201 }
catch ( Exception
$e ) {
211 if ( self::showBackTrace(
$e ) ) {
241 $vars[] =
'$wgShowExceptionDetails = true;';
244 $vars[] =
'$wgShowDBErrorBacktrace = true;';
247 return "Set $vars at the bottom of LocalSettings.php to show detailed debugging information.";
254 return !empty(
$GLOBALS[
'wgCommandLineMode'] );
261 if ( !headers_sent() ) {
270 if ( !headers_sent() ) {
285 if ( defined(
'STDERR' ) ) {
286 fwrite( STDERR, $message );
298 $sorry = htmlspecialchars( self::msg(
300 'Sorry! This site is experiencing technical difficulties.'
302 $again = htmlspecialchars( self::msg(
304 'Try waiting a few minutes and reloading.'
311 htmlspecialchars( self::msg(
'dberr-info',
'($1)' ) )
314 $info = htmlspecialchars( self::msg(
316 '(Cannot access the database)'
322 $html =
"<h1>$sorry</h1><p>$again</p><p><small>$info</small></p>";
325 $html .=
'<p>Backtrace:</p><pre>' .
326 htmlspecialchars(
$e->getTraceAsString() ) .
'</pre>';
341 $usegoogle = htmlspecialchars( self::msg(
343 'You can try searching via Google in the meantime.'
345 $outofdate = htmlspecialchars( self::msg(
347 'Note that their indexes of our content may be out of date.'
349 $googlesearch = htmlspecialchars( self::msg(
'searchbutton',
'Search' ) );
350 $search = htmlspecialchars(
$wgRequest->getVal(
'search' ) );
354 <div
style=
"margin: 1.5em">$usegoogle<br />
355 <small>$outofdate</small>
357 <
form method=
"get" action=
"//www.google.com/search" id=
"googlesearch">
362 <input
type=
"text" name=
"q" size=
"31" maxlength=
"255" value=
"$search" />
365 <label><input
type=
"radio" name=
"sitesearch" value=
"$server" checked=
"checked" />$sitename</label>
366 <label><input
type=
"radio" name=
"sitesearch" value=
"" />WWW</label>
This document describes the state of Postgres support in and is fairly well maintained The main code is very well while extensions are very hit and miss it is probably the most supported database after MySQL Much of the work in making MediaWiki database agnostic came about through the work of creating Postgres as and are nearing end of but without copying over all the usage comments General notes on the but these can almost always be programmed around *Although Postgres has a true BOOLEAN type
$wgShowSQLErrors
Whether to show "we're sorry, but there has been a database error" pages.
$wgMimeType
The default Content-Type header.
$wgShowHostnames
Expose backend server host names through the API and various HTML comments.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
wfMsgReplaceArgs( $message, $args)
Replace message parameter keys on the given formatted output.
static reportOutageHTML( $e)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static getPublicLogMessage( $e)
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
static getURL()
If the exception occurred in the course of responding to a request, returns the requested URL.
static getLogMessage( $e)
Get a message formatting the exception message and its origin.
null means default in associative array form
static showBackTrace( $e)
when a variable name is used in a it is silently declared as a new masking the global
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
$GLOBALS['wgAutoloadClasses']['LocalisationUpdate']
$wgShowDBErrorBacktrace
If true, show a backtrace for database errors.
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
static singleton()
Get the signleton instance of this class.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
static useOutputPage( $e)
$wgSitename
Name of the site.
static msg( $key, $fallback)
Get a message from i18n.
static googleSearchForm()
static printError( $message)
Print a message, if possible to STDERR.
static getMain()
Static methods.
static output( $e, $mode, $eNew=null)
wfHttpError( $code, $label, $desc)
Provide a simple HTTP error.
static header( $code)
Output an HTTP status code header.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
static getRequestId()
Get the unique request ID.
$wgShowExceptionDetails
If set to true, uncaught exceptions will print a complete stack trace to output.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static statusHeader( $code)
static getHTML( $e)
If $wgShowExceptionDetails is true, return a HTML message with a backtrace to the error,...
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at name
static reportHTML( $e)
Output the exception report using HTML.
if(! $wgDBerrorLogTZ) $wgRequest
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Class to expose exceptions to the client (API bots, users, admins using CLI scripts)
static getRedactedTraceAsString( $e)
Generate a string representation of an exception's stack trace.
static getShowBacktraceError( $e)