MediaWiki  1.27.2
MWDebug.php
Go to the documentation of this file.
1 <?php
31 class MWDebug {
37  protected static $log = [];
38 
44  protected static $debug = [];
45 
51  protected static $query = [];
52 
58  protected static $enabled = false;
59 
66  protected static $deprecationWarnings = [];
67 
74  public static function init() {
75  self::$enabled = true;
76  }
77 
85  public static function addModules( OutputPage $out ) {
86  if ( self::$enabled ) {
87  $out->addModules( 'mediawiki.debug.init' );
88  }
89  }
90 
97  public static function log( $str ) {
98  if ( !self::$enabled ) {
99  return;
100  }
101  if ( !is_string( $str ) ) {
102  $str = print_r( $str, true );
103  }
104  self::$log[] = [
105  'msg' => htmlspecialchars( $str ),
106  'type' => 'log',
107  'caller' => wfGetCaller(),
108  ];
109  }
110 
116  public static function getLog() {
117  return self::$log;
118  }
119 
124  public static function clearLog() {
125  self::$log = [];
126  self::$deprecationWarnings = [];
127  }
128 
142  public static function warning( $msg, $callerOffset = 1, $level = E_USER_NOTICE, $log = 'auto' ) {
143  global $wgDevelopmentWarnings;
144 
145  if ( $log === 'auto' && !$wgDevelopmentWarnings ) {
146  $log = 'debug';
147  }
148 
149  if ( $log === 'debug' ) {
150  $level = false;
151  }
152 
153  $callerDescription = self::getCallerDescription( $callerOffset );
154 
155  self::sendMessage( $msg, $callerDescription, 'warning', $level );
156 
157  if ( self::$enabled ) {
158  self::$log[] = [
159  'msg' => htmlspecialchars( $msg ),
160  'type' => 'warn',
161  'caller' => $callerDescription['func'],
162  ];
163  }
164  }
165 
184  public static function deprecated( $function, $version = false,
185  $component = false, $callerOffset = 2
186  ) {
187  $callerDescription = self::getCallerDescription( $callerOffset );
188  $callerFunc = $callerDescription['func'];
189 
190  $sendToLog = true;
191 
192  // Check to see if there already was a warning about this function
193  if ( isset( self::$deprecationWarnings[$function][$callerFunc] ) ) {
194  return;
195  } elseif ( isset( self::$deprecationWarnings[$function] ) ) {
196  if ( self::$enabled ) {
197  $sendToLog = false;
198  } else {
199  return;
200  }
201  }
202 
203  self::$deprecationWarnings[$function][$callerFunc] = true;
204 
205  if ( $version ) {
206  global $wgDeprecationReleaseLimit;
207  if ( $wgDeprecationReleaseLimit && $component === false ) {
208  # Strip -* off the end of $version so that branches can use the
209  # format #.##-branchname to avoid issues if the branch is merged into
210  # a version of MediaWiki later than what it was branched from
211  $comparableVersion = preg_replace( '/-.*$/', '', $version );
212 
213  # If the comparableVersion is larger than our release limit then
214  # skip the warning message for the deprecation
215  if ( version_compare( $wgDeprecationReleaseLimit, $comparableVersion, '<' ) ) {
216  $sendToLog = false;
217  }
218  }
219 
220  $component = $component === false ? 'MediaWiki' : $component;
221  $msg = "Use of $function was deprecated in $component $version.";
222  } else {
223  $msg = "Use of $function is deprecated.";
224  }
225 
226  if ( $sendToLog ) {
227  global $wgDevelopmentWarnings; // we could have a more specific $wgDeprecationWarnings setting.
228  self::sendMessage(
229  $msg,
230  $callerDescription,
231  'deprecated',
232  $wgDevelopmentWarnings ? E_USER_DEPRECATED : false
233  );
234  }
235 
236  if ( self::$enabled ) {
237  $logMsg = htmlspecialchars( $msg ) .
238  Html::rawElement( 'div', [ 'class' => 'mw-debug-backtrace' ],
239  Html::element( 'span', [], 'Backtrace:' ) . wfBacktrace()
240  );
241 
242  self::$log[] = [
243  'msg' => $logMsg,
244  'type' => 'deprecated',
245  'caller' => $callerFunc,
246  ];
247  }
248  }
249 
257  private static function getCallerDescription( $callerOffset ) {
258  $callers = wfDebugBacktrace();
259 
260  if ( isset( $callers[$callerOffset] ) ) {
261  $callerfile = $callers[$callerOffset];
262  if ( isset( $callerfile['file'] ) && isset( $callerfile['line'] ) ) {
263  $file = $callerfile['file'] . ' at line ' . $callerfile['line'];
264  } else {
265  $file = '(internal function)';
266  }
267  } else {
268  $file = '(unknown location)';
269  }
270 
271  if ( isset( $callers[$callerOffset + 1] ) ) {
272  $callerfunc = $callers[$callerOffset + 1];
273  $func = '';
274  if ( isset( $callerfunc['class'] ) ) {
275  $func .= $callerfunc['class'] . '::';
276  }
277  if ( isset( $callerfunc['function'] ) ) {
278  $func .= $callerfunc['function'];
279  }
280  } else {
281  $func = 'unknown';
282  }
283 
284  return [ 'file' => $file, 'func' => $func ];
285  }
286 
296  private static function sendMessage( $msg, $caller, $group, $level ) {
297  $msg .= ' [Called from ' . $caller['func'] . ' in ' . $caller['file'] . ']';
298 
299  if ( $level !== false ) {
300  trigger_error( $msg, $level );
301  }
302 
303  wfDebugLog( $group, $msg, 'private' );
304  }
305 
314  public static function debugMsg( $str, $context = [] ) {
315  global $wgDebugComments, $wgShowDebug;
316 
317  if ( self::$enabled || $wgDebugComments || $wgShowDebug ) {
318  if ( $context ) {
319  $prefix = '';
320  if ( isset( $context['prefix'] ) ) {
321  $prefix = $context['prefix'];
322  } elseif ( isset( $context['channel'] ) && $context['channel'] !== 'wfDebug' ) {
323  $prefix = "[{$context['channel']}] ";
324  }
325  if ( isset( $context['seconds_elapsed'] ) && isset( $context['memory_used'] ) ) {
326  $prefix .= "{$context['seconds_elapsed']} {$context['memory_used']} ";
327  }
328  $str = $prefix . $str;
329  }
330  self::$debug[] = rtrim( UtfNormal\Validator::cleanUp( $str ) );
331  }
332  }
333 
344  public static function query( $sql, $function, $isMaster ) {
345  if ( !self::$enabled ) {
346  return -1;
347  }
348 
349  // Replace invalid UTF-8 chars with a square UTF-8 character
350  // This prevents json_encode from erroring out due to binary SQL data
351  $sql = preg_replace(
352  '/(
353  [\xC0-\xC1] # Invalid UTF-8 Bytes
354  | [\xF5-\xFF] # Invalid UTF-8 Bytes
355  | \xE0[\x80-\x9F] # Overlong encoding of prior code point
356  | \xF0[\x80-\x8F] # Overlong encoding of prior code point
357  | [\xC2-\xDF](?![\x80-\xBF]) # Invalid UTF-8 Sequence Start
358  | [\xE0-\xEF](?![\x80-\xBF]{2}) # Invalid UTF-8 Sequence Start
359  | [\xF0-\xF4](?![\x80-\xBF]{3}) # Invalid UTF-8 Sequence Start
360  | (?<=[\x0-\x7F\xF5-\xFF])[\x80-\xBF] # Invalid UTF-8 Sequence Middle
361  | (?<![\xC2-\xDF]|[\xE0-\xEF]|[\xE0-\xEF][\x80-\xBF]|[\xF0-\xF4]
362  |[\xF0-\xF4][\x80-\xBF]|[\xF0-\xF4][\x80-\xBF]{2})[\x80-\xBF] # Overlong Sequence
363  | (?<=[\xE0-\xEF])[\x80-\xBF](?![\x80-\xBF]) # Short 3 byte sequence
364  | (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence
365  | (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2)
366  )/x',
367  '■',
368  $sql
369  );
370 
371  // last check for invalid utf8
372  $sql = UtfNormal\Validator::cleanUp( $sql );
373 
374  self::$query[] = [
375  'sql' => $sql,
376  'function' => $function,
377  'master' => (bool)$isMaster,
378  'time' => 0.0,
379  '_start' => microtime( true ),
380  ];
381 
382  return count( self::$query ) - 1;
383  }
384 
391  public static function queryTime( $id ) {
392  if ( $id === -1 || !self::$enabled ) {
393  return;
394  }
395 
396  self::$query[$id]['time'] = microtime( true ) - self::$query[$id]['_start'];
397  unset( self::$query[$id]['_start'] );
398  }
399 
406  protected static function getFilesIncluded( IContextSource $context ) {
407  $files = get_included_files();
408  $fileList = [];
409  foreach ( $files as $file ) {
410  $size = filesize( $file );
411  $fileList[] = [
412  'name' => $file,
413  'size' => $context->getLanguage()->formatSize( $size ),
414  ];
415  }
416 
417  return $fileList;
418  }
419 
427  public static function getDebugHTML( IContextSource $context ) {
428  global $wgDebugComments;
429 
430  $html = '';
431 
432  if ( self::$enabled ) {
433  MWDebug::log( 'MWDebug output complete' );
434  $debugInfo = self::getDebugInfo( $context );
435 
436  // Cannot use OutputPage::addJsConfigVars because those are already outputted
437  // by the time this method is called.
439  ResourceLoader::makeConfigSetScript( [ 'debugInfo' => $debugInfo ] )
440  );
441  }
442 
443  if ( $wgDebugComments ) {
444  $html .= "<!-- Debug output:\n" .
445  htmlspecialchars( implode( "\n", self::$debug ) ) .
446  "\n\n-->";
447  }
448 
449  return $html;
450  }
451 
460  public static function getHTMLDebugLog() {
461  global $wgShowDebug;
462 
463  if ( !$wgShowDebug ) {
464  return '';
465  }
466 
467  $ret = "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">\n";
468 
469  foreach ( self::$debug as $line ) {
470  $display = nl2br( htmlspecialchars( trim( $line ) ) );
471 
472  $ret .= "<li><code>$display</code></li>\n";
473  }
474 
475  $ret .= '</ul>' . "\n";
476 
477  return $ret;
478  }
479 
487  if ( !self::$enabled ) {
488  return;
489  }
490 
491  // output errors as debug info, when display_errors is on
492  // this is necessary for all non html output of the api, because that clears all errors first
493  $obContents = ob_get_contents();
494  if ( $obContents ) {
495  $obContentArray = explode( '<br />', $obContents );
496  foreach ( $obContentArray as $obContent ) {
497  if ( trim( $obContent ) ) {
498  self::debugMsg( Sanitizer::stripAllTags( $obContent ) );
499  }
500  }
501  }
502 
503  MWDebug::log( 'MWDebug output complete' );
504  $debugInfo = self::getDebugInfo( $context );
505 
506  ApiResult::setIndexedTagName( $debugInfo, 'debuginfo' );
507  ApiResult::setIndexedTagName( $debugInfo['log'], 'line' );
508  ApiResult::setIndexedTagName( $debugInfo['debugLog'], 'msg' );
509  ApiResult::setIndexedTagName( $debugInfo['queries'], 'query' );
510  ApiResult::setIndexedTagName( $debugInfo['includes'], 'queries' );
511  $result->addValue( null, 'debuginfo', $debugInfo );
512  }
513 
520  public static function getDebugInfo( IContextSource $context ) {
521  if ( !self::$enabled ) {
522  return [];
523  }
524 
526  $request = $context->getRequest();
527 
528  // HHVM's reported memory usage from memory_get_peak_usage()
529  // is not useful when passing false, but we continue passing
530  // false for consistency of historical data in zend.
531  // see: https://github.com/facebook/hhvm/issues/2257#issuecomment-39362246
532  $realMemoryUsage = wfIsHHVM();
533 
534  return [
535  'mwVersion' => $wgVersion,
536  'phpEngine' => wfIsHHVM() ? 'HHVM' : 'PHP',
537  'phpVersion' => wfIsHHVM() ? HHVM_VERSION : PHP_VERSION,
538  'gitRevision' => GitInfo::headSHA1(),
539  'gitBranch' => GitInfo::currentBranch(),
540  'gitViewUrl' => GitInfo::headViewUrl(),
541  'time' => microtime( true ) - $wgRequestTime,
542  'log' => self::$log,
543  'debugLog' => self::$debug,
544  'queries' => self::$query,
545  'request' => [
546  'method' => $request->getMethod(),
547  'url' => $request->getRequestURL(),
548  'headers' => $request->getAllHeaders(),
549  'params' => $request->getValues(),
550  ],
551  'memory' => $context->getLanguage()->formatSize( memory_get_usage( $realMemoryUsage ) ),
552  'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage( $realMemoryUsage ) ),
553  'includes' => self::getFilesIncluded( $context ),
554  ];
555  }
556 }
static getLog()
Returns internal log array.
Definition: MWDebug.php:116
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:1798
Interface for objects which can provide a MediaWiki context on request.
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 $out
Definition: hooks.txt:762
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:1418
$wgVersion
MediaWiki version number.
$context
Definition: load.php:44
static warning($msg, $callerOffset=1, $level=E_USER_NOTICE, $log= 'auto')
Adds a warning entry to the log.
Definition: MWDebug.php:142
wfIsHHVM()
Check if we are running under HHVM.
static getFilesIncluded(IContextSource $context)
Returns a list of files included, along with their size.
Definition: MWDebug.php:406
static debugMsg($str, $context=[])
This is a method to pass messages from wfDebug to the pretty debugger.
Definition: MWDebug.php:314
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:1798
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
Definition: Html.php:210
wfDebugBacktrace($limit=0)
Safety wrapper for debug_backtrace().
wfBacktrace($raw=null)
Get a debug backtrace as a string.
static $deprecationWarnings
Array of functions that have already been warned, formatted function-caller to prevent a buttload of ...
Definition: MWDebug.php:66
$files
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
static stripAllTags($text)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed, encoded as plain text.
Definition: Sanitizer.php:1785
when a variable name is used in a it is silently declared as a new local masking the global
Definition: design.txt:93
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
Definition: ApiResult.php:618
static getHTMLDebugLog()
Generate debug log in HTML for displaying at the bottom of the main content area. ...
Definition: MWDebug.php:460
static headSHA1()
Definition: GitInfo.php:368
addModules($modules)
Add one or more modules recognized by ResourceLoader.
Definition: OutputPage.php:570
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. '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 '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. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) '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 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) '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:Associative array mapping language codes to prefixed links of the form"language:title".&$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':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:1796
wfDebugLog($logGroup, $text, $dest= 'all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
Unicode normalization routines for working with UTF-8 strings.
Definition: UtfNormal.php:48
static $query
SQL statements of the database queries.
Definition: MWDebug.php:51
addValue($path, $name, $value, $flags=0)
Add value to the output data at the given path.
Definition: ApiResult.php:405
static deprecated($function, $version=false, $component=false, $callerOffset=2)
Show a warning that $function is deprecated.
Definition: MWDebug.php:184
static $log
Log lines.
Definition: MWDebug.php:37
static $enabled
Is the debugger enabled?
Definition: MWDebug.php:58
static queryTime($id)
Calculates how long a query took.
Definition: MWDebug.php:391
static log($str)
Adds a line to the log.
Definition: MWDebug.php:97
static makeInlineScript($script)
Construct an inline script tag with given JS code.
static addModules(OutputPage $out)
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
Definition: MWDebug.php:85
static getDebugInfo(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
Definition: MWDebug.php:520
This class represents the result of the API operations.
Definition: ApiResult.php:33
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:296
getLanguage()
Get the Language object.
static clearLog()
Clears internal log array and deprecation tracking.
Definition: MWDebug.php:124
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
Definition: distributors.txt:9
This class should be covered by a general architecture document which does not exist as of January 20...
Definition: OutputPage.php:42
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:35
static getCallerDescription($callerOffset)
Get an array describing the calling function at a specified offset.
Definition: MWDebug.php:257
error also a ContextSource you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2418
static appendDebugInfoToApiResult(IContextSource $context, ApiResult $result)
Append the debug info to given ApiResult.
Definition: MWDebug.php:486
$line
Definition: cdb.php:59
static query($sql, $function, $isMaster)
Begins profiling on a database query.
Definition: MWDebug.php:344
static headViewUrl()
Definition: GitInfo.php:384
$version
Definition: parserTests.php:85
$debug
Definition: mcc.php:31
float $wgRequestTime
Request start time as fractional seconds since epoch.
Definition: WebStart.php:43
static currentBranch()
Definition: GitInfo.php:376
static $debug
Debug messages from wfDebug().
Definition: MWDebug.php:44
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:230
static init()
Enabled the debugger and load resource module.
Definition: MWDebug.php:74
static getDebugHTML(IContextSource $context)
Returns the HTML to add to the page for the toolbar.
Definition: MWDebug.php:427
getRequest()
Get the WebRequest object.
wfGetCaller($level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...