MediaWiki REL1_33
MWDebug.php
Go to the documentation of this file.
1<?php
24
33class MWDebug {
39 protected static $log = [];
40
46 protected static $debug = [];
47
53 protected static $query = [];
54
60 protected static $enabled = false;
61
68 protected static $deprecationWarnings = [];
69
76 public static function init() {
77 self::$enabled = true;
78 }
79
85 public static function deinit() {
86 self::$enabled = false;
87 }
88
96 public static function addModules( OutputPage $out ) {
97 if ( self::$enabled ) {
98 $out->addModules( 'mediawiki.debug' );
99 }
100 }
101
108 public static function log( $str ) {
109 if ( !self::$enabled ) {
110 return;
111 }
112 if ( !is_string( $str ) ) {
113 $str = print_r( $str, true );
114 }
115 self::$log[] = [
116 'msg' => htmlspecialchars( $str ),
117 'type' => 'log',
118 'caller' => wfGetCaller(),
119 ];
120 }
121
127 public static function getLog() {
128 return self::$log;
129 }
130
135 public static function clearLog() {
136 self::$log = [];
137 self::$deprecationWarnings = [];
138 }
139
151 public static function warning( $msg, $callerOffset = 1, $level = E_USER_NOTICE, $log = 'auto' ) {
153
154 if ( $log === 'auto' && !$wgDevelopmentWarnings ) {
155 $log = 'debug';
156 }
157
158 if ( $log === 'debug' ) {
159 $level = false;
160 }
161
162 $callerDescription = self::getCallerDescription( $callerOffset );
163
164 self::sendMessage( $msg, $callerDescription, 'warning', $level );
165
166 if ( self::$enabled ) {
167 self::$log[] = [
168 'msg' => htmlspecialchars( $msg ),
169 'type' => 'warn',
170 'caller' => $callerDescription['func'],
171 ];
172 }
173 }
174
193 public static function deprecated( $function, $version = false,
194 $component = false, $callerOffset = 2
195 ) {
196 $callerDescription = self::getCallerDescription( $callerOffset );
197 $callerFunc = $callerDescription['func'];
198
199 $sendToLog = true;
200
201 // Check to see if there already was a warning about this function
202 if ( isset( self::$deprecationWarnings[$function][$callerFunc] ) ) {
203 return;
204 } elseif ( isset( self::$deprecationWarnings[$function] ) ) {
205 if ( self::$enabled ) {
206 $sendToLog = false;
207 } else {
208 return;
209 }
210 }
211
212 self::$deprecationWarnings[$function][$callerFunc] = true;
213
214 if ( $version ) {
216 if ( $wgDeprecationReleaseLimit && $component === false ) {
217 # Strip -* off the end of $version so that branches can use the
218 # format #.##-branchname to avoid issues if the branch is merged into
219 # a version of MediaWiki later than what it was branched from
220 $comparableVersion = preg_replace( '/-.*$/', '', $version );
221
222 # If the comparableVersion is larger than our release limit then
223 # skip the warning message for the deprecation
224 if ( version_compare( $wgDeprecationReleaseLimit, $comparableVersion, '<' ) ) {
225 $sendToLog = false;
226 }
227 }
228
229 $component = $component === false ? 'MediaWiki' : $component;
230 $msg = "Use of $function was deprecated in $component $version.";
231 } else {
232 $msg = "Use of $function is deprecated.";
233 }
234
235 if ( $sendToLog ) {
236 global $wgDevelopmentWarnings; // we could have a more specific $wgDeprecationWarnings setting.
237 self::sendMessage(
238 $msg,
239 $callerDescription,
240 'deprecated',
241 $wgDevelopmentWarnings ? E_USER_DEPRECATED : false
242 );
243 }
244
245 if ( self::$enabled ) {
246 $logMsg = htmlspecialchars( $msg ) .
247 Html::rawElement( 'div', [ 'class' => 'mw-debug-backtrace' ],
248 Html::element( 'span', [], 'Backtrace:' ) . wfBacktrace()
249 );
250
251 self::$log[] = [
252 'msg' => $logMsg,
253 'type' => 'deprecated',
254 'caller' => $callerFunc,
255 ];
256 }
257 }
258
266 private static function getCallerDescription( $callerOffset ) {
267 $callers = wfDebugBacktrace();
268
269 if ( isset( $callers[$callerOffset] ) ) {
270 $callerfile = $callers[$callerOffset];
271 if ( isset( $callerfile['file'] ) && isset( $callerfile['line'] ) ) {
272 $file = $callerfile['file'] . ' at line ' . $callerfile['line'];
273 } else {
274 $file = '(internal function)';
275 }
276 } else {
277 $file = '(unknown location)';
278 }
279
280 if ( isset( $callers[$callerOffset + 1] ) ) {
281 $callerfunc = $callers[$callerOffset + 1];
282 $func = '';
283 if ( isset( $callerfunc['class'] ) ) {
284 $func .= $callerfunc['class'] . '::';
285 }
286 if ( isset( $callerfunc['function'] ) ) {
287 $func .= $callerfunc['function'];
288 }
289 } else {
290 $func = 'unknown';
291 }
292
293 return [ 'file' => $file, 'func' => $func ];
294 }
295
305 private static function sendMessage( $msg, $caller, $group, $level ) {
306 $msg .= ' [Called from ' . $caller['func'] . ' in ' . $caller['file'] . ']';
307
308 if ( $level !== false ) {
309 trigger_error( $msg, $level );
310 }
311
312 wfDebugLog( $group, $msg, 'private' );
313 }
314
323 public static function debugMsg( $str, $context = [] ) {
325
326 if ( self::$enabled || $wgDebugComments || $wgShowDebug ) {
327 if ( $context ) {
328 $prefix = '';
329 if ( isset( $context['prefix'] ) ) {
330 $prefix = $context['prefix'];
331 } elseif ( isset( $context['channel'] ) && $context['channel'] !== 'wfDebug' ) {
332 $prefix = "[{$context['channel']}] ";
333 }
334 if ( isset( $context['seconds_elapsed'] ) && isset( $context['memory_used'] ) ) {
335 $prefix .= "{$context['seconds_elapsed']} {$context['memory_used']} ";
336 }
337 $str = LegacyLogger::interpolate( $str, $context );
338 $str = $prefix . $str;
339 }
340 self::$debug[] = rtrim( UtfNormal\Validator::cleanUp( $str ) );
341 }
342 }
343
354 public static function query( $sql, $function, $isMaster, $runTime ) {
355 if ( !self::$enabled ) {
356 return false;
357 }
358
359 // Replace invalid UTF-8 chars with a square UTF-8 character
360 // This prevents json_encode from erroring out due to binary SQL data
361 $sql = preg_replace(
362 '/(
363 [\xC0-\xC1] # Invalid UTF-8 Bytes
364 | [\xF5-\xFF] # Invalid UTF-8 Bytes
365 | \xE0[\x80-\x9F] # Overlong encoding of prior code point
366 | \xF0[\x80-\x8F] # Overlong encoding of prior code point
367 | [\xC2-\xDF](?![\x80-\xBF]) # Invalid UTF-8 Sequence Start
368 | [\xE0-\xEF](?![\x80-\xBF]{2}) # Invalid UTF-8 Sequence Start
369 | [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start
370 | (?<=[\x0-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle
371 | (?<![\xC2-\xDF]|[\xE0-\xEF]|[\xE0-\xEF][\x80-\xBF]|[\xF0-\xF4]
372 | [\xF0-\xF4][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF]{2})[\x80-\xBF] # Overlong Sequence
373 | (?<=[\xE0-\xEF])[\x80-\xBF](?![\x80-\xBF]) # Short 3 byte sequence
374 | (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence
375 | (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2)
376 )/x',
377 '■',
378 $sql
379 );
380
381 // last check for invalid utf8
382 $sql = UtfNormal\Validator::cleanUp( $sql );
383
384 self::$query[] = [
385 'sql' => $sql,
386 'function' => $function,
387 'master' => (bool)$isMaster,
388 'time' => $runTime,
389 ];
390
391 return true;
392 }
393
400 protected static function getFilesIncluded( IContextSource $context ) {
401 $files = get_included_files();
402 $fileList = [];
403 foreach ( $files as $file ) {
404 $size = filesize( $file );
405 $fileList[] = [
406 'name' => $file,
407 'size' => $context->getLanguage()->formatSize( $size ),
408 ];
409 }
410
411 return $fileList;
412 }
413
421 public static function getDebugHTML( IContextSource $context ) {
422 global $wgDebugComments;
423
424 $html = '';
425
426 if ( self::$enabled ) {
427 self::log( 'MWDebug output complete' );
428 $debugInfo = self::getDebugInfo( $context );
429
430 // Cannot use OutputPage::addJsConfigVars because those are already outputted
431 // by the time this method is called.
432 $html = ResourceLoader::makeInlineScript(
433 ResourceLoader::makeConfigSetScript( [ 'debugInfo' => $debugInfo ] ),
434 $context->getOutput()->getCSPNonce()
435 );
436 }
437
438 if ( $wgDebugComments ) {
439 $html .= "<!-- Debug output:\n" .
440 htmlspecialchars( implode( "\n", self::$debug ), ENT_NOQUOTES ) .
441 "\n\n-->";
442 }
443
444 return $html;
445 }
446
455 public static function getHTMLDebugLog() {
456 global $wgShowDebug;
457
458 if ( !$wgShowDebug ) {
459 return '';
460 }
461
462 $ret = "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">\n";
463
464 foreach ( self::$debug as $line ) {
465 $display = nl2br( htmlspecialchars( trim( $line ) ) );
466
467 $ret .= "<li><code>$display</code></li>\n";
468 }
469
470 $ret .= '</ul>' . "\n";
471
472 return $ret;
473 }
474
482 if ( !self::$enabled ) {
483 return;
484 }
485
486 // output errors as debug info, when display_errors is on
487 // this is necessary for all non html output of the api, because that clears all errors first
488 $obContents = ob_get_contents();
489 if ( $obContents ) {
490 $obContentArray = explode( '<br />', $obContents );
491 foreach ( $obContentArray as $obContent ) {
492 if ( trim( $obContent ) ) {
493 self::debugMsg( Sanitizer::stripAllTags( $obContent ) );
494 }
495 }
496 }
497
498 self::log( 'MWDebug output complete' );
499 $debugInfo = self::getDebugInfo( $context );
500
501 ApiResult::setIndexedTagName( $debugInfo, 'debuginfo' );
502 ApiResult::setIndexedTagName( $debugInfo['log'], 'line' );
503 ApiResult::setIndexedTagName( $debugInfo['debugLog'], 'msg' );
504 ApiResult::setIndexedTagName( $debugInfo['queries'], 'query' );
505 ApiResult::setIndexedTagName( $debugInfo['includes'], 'queries' );
506 $result->addValue( null, 'debuginfo', $debugInfo );
507 }
508
515 public static function getDebugInfo( IContextSource $context ) {
516 if ( !self::$enabled ) {
517 return [];
518 }
519
520 global $wgVersion;
521 $request = $context->getRequest();
522
523 // HHVM's reported memory usage from memory_get_peak_usage()
524 // is not useful when passing false, but we continue passing
525 // false for consistency of historical data in zend.
526 // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246
527 $realMemoryUsage = wfIsHHVM();
528
529 $branch = GitInfo::currentBranch();
530 if ( GitInfo::isSHA1( $branch ) ) {
531 // If it's a detached HEAD, the SHA1 will already be
532 // included in the MW version, so don't show it.
533 $branch = false;
534 }
535
536 return [
537 'mwVersion' => $wgVersion,
538 'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP',
539 'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION,
540 'gitRevision' => GitInfo::headSHA1(),
541 'gitBranch' => $branch,
542 'gitViewUrl' => GitInfo::headViewUrl(),
543 'time' => $request->getElapsedTime(),
544 'log' => self::$log,
545 'debugLog' => self::$debug,
546 'queries' => self::$query,
547 'request' => [
548 'method' => $request->getMethod(),
549 'url' => $request->getRequestURL(),
550 'headers' => $request->getAllHeaders(),
551 'params' => $request->getValues(),
552 ],
553 'memory' => $context->getLanguage()->formatSize( memory_get_usage( $realMemoryUsage ) ),
554 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage( $realMemoryUsage ) ),
555 'includes' => self::getFilesIncluded( $context ),
556 ];
557 }
558}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
$wgDeprecationReleaseLimit
Release limitation to wfDeprecated warnings, if set to a release number development warnings will not...
$wgDebugComments
Send debug data to an HTML comment in the output.
$wgVersion
MediaWiki version number.
$wgShowDebug
Display debug data at the bottom of the main content area.
$wgDevelopmentWarnings
If set to true MediaWiki will throw notices for some possible error conditions and for deprecated fun...
wfBacktrace( $raw=null)
Get a debug backtrace as a string.
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfDebugBacktrace( $limit=0)
Safety wrapper for debug_backtrace().
wfIsHHVM()
Check if we are running under HHVM.
$line
Definition cdb.php:59
This class represents the result of the API operations.
Definition ApiResult.php:35
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static headSHA1()
Definition GitInfo.php:392
static headViewUrl()
Definition GitInfo.php:408
static currentBranch()
Definition GitInfo.php:400
static isSHA1( $str)
Check if a string looks like a hex encoded SHA1 hash.
Definition GitInfo.php:158
New debugger system that outputs a toolbar on page view.
Definition MWDebug.php:33
static warning( $msg, $callerOffset=1, $level=E_USER_NOTICE, $log='auto')
Adds a warning entry to the log.
Definition MWDebug.php:151
static getFilesIncluded(IContextSource $context)
Returns a list of files included, along with their size.
Definition MWDebug.php:400
static $enabled
Is the debugger enabled?
Definition MWDebug.php:60
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
Definition MWDebug.php:96
static appendDebugInfoToApiResult(IContextSource $context, ApiResult $result)
Append the debug info to given ApiResult.
Definition MWDebug.php:481
static $deprecationWarnings
Array of functions that have already been warned, formatted function-caller to prevent a buttload of ...
Definition MWDebug.php:68
static clearLog()
Clears internal log array and deprecation tracking.
Definition MWDebug.php:135
static deinit()
Disable the debugger.
Definition MWDebug.php:85
static query( $sql, $function, $isMaster, $runTime)
Begins profiling on a database query.
Definition MWDebug.php:354
static getLog()
Returns internal log array.
Definition MWDebug.php:127
static log( $str)
Adds a line to the log.
Definition MWDebug.php:108
static getDebugInfo(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
Definition MWDebug.php:515
static debugMsg( $str, $context=[])
This is a method to pass messages from wfDebug to the pretty debugger.
Definition MWDebug.php:323
static getCallerDescription( $callerOffset)
Get an array describing the calling function at a specified offset.
Definition MWDebug.php:266
static $log
Log lines.
Definition MWDebug.php:39
static deprecated( $function, $version=false, $component=false, $callerOffset=2)
Show a warning that $function is deprecated.
Definition MWDebug.php:193
static sendMessage( $msg, $caller, $group, $level)
Send a message to the debug log and optionally also trigger a PHP error, depending on the $level argu...
Definition MWDebug.php:305
static getHTMLDebugLog()
Generate debug log in HTML for displaying at the bottom of the main content area.
Definition MWDebug.php:455
static init()
Enabled the debugger and load resource module.
Definition MWDebug.php:76
static getDebugHTML(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
Definition MWDebug.php:421
PSR-3 logger that mimics the historic implementation of MediaWiki's former wfErrorLog logging impleme...
This class should be covered by a general architecture document which does not exist as of January 20...
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition hooks.txt:2843
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page. Return false to stop further processing of the tag $reader:XMLReader object & $pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports. & $fullInterwikiPrefix:Interwiki prefix, may contain colons. & $pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable. Can be used to lazy-load the import sources list. & $importSources:The value of $wgImportSources. Modify as necessary. See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. & $title:Title object for the current page & $request:WebRequest & $ignoreRedirect:boolean to skip redirect check & $target:Title/string of redirect target & $article:Article object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) & $article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() & $ip:IP being check & $result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Array with elements of the form "language:title" in the order that they will be output. & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LanguageSelector':Hook to change the language selector available on a page. $out:The output page. $cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition hooks.txt:1991
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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 $out
Definition hooks.txt:855
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
Definition hooks.txt:2848
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 & $ret
Definition hooks.txt:2003
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
Definition hooks.txt:2011
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1617
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187
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
Definition injection.txt:37
Interface for objects which can provide a MediaWiki context on request.
$debug
Definition mcc.php:31
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Definition router.php:42