MediaWiki
1.34.0
|
New debugger system that outputs a toolbar on page view. More...
Static Public Member Functions | |
static | addModules (OutputPage $out) |
Add ResourceLoader modules to the OutputPage object if debugging is enabled. More... | |
static | appendDebugInfoToApiResult (IContextSource $context, ApiResult $result) |
Append the debug info to given ApiResult. More... | |
static | clearLog () |
Clears internal log array and deprecation tracking. More... | |
static | debugMsg ( $str, $context=[]) |
This is a method to pass messages from wfDebug to the pretty debugger. More... | |
static | deinit () |
Disable the debugger. More... | |
static | deprecated ( $function, $version=false, $component=false, $callerOffset=2) |
Show a warning that $function is deprecated. More... | |
static | getDebugHTML (IContextSource $context) |
Returns the HTML to add to the page for the toolbar. More... | |
static | getDebugInfo (IContextSource $context) |
Returns the HTML to add to the page for the toolbar. More... | |
static | getHTMLDebugLog () |
Generate debug log in HTML for displaying at the bottom of the main content area. More... | |
static | getLog () |
Returns internal log array. More... | |
static | init () |
Enabled the debugger and load resource module. More... | |
static | log ( $str) |
Adds a line to the log. More... | |
static | query ( $sql, $function, $runTime, $dbhost) |
Begins profiling on a database query. More... | |
static | setup () |
static | warning ( $msg, $callerOffset=1, $level=E_USER_NOTICE, $log='auto') |
Adds a warning entry to the log. More... | |
Static Protected Member Functions | |
static | getFilesIncluded (IContextSource $context) |
Returns a list of files included, along with their size. More... | |
Static Protected Attributes | |
static | $debug = [] |
Debug messages from wfDebug(). More... | |
static | $deprecationWarnings = [] |
Array of functions that have already been warned, formatted function-caller to prevent a buttload of warnings. More... | |
static | $enabled = false |
Is the debugger enabled? More... | |
static | $log = [] |
Log lines. More... | |
static | $query = [] |
SQL statements of the database queries. More... | |
Static Private Member Functions | |
static | getCallerDescription ( $callerOffset) |
Get an array describing the calling function at a specified offset. More... | |
static | sendMessage ( $msg, $caller, $group, $level) |
Send a message to the debug log and optionally also trigger a PHP error, depending on the $level argument. More... | |
New debugger system that outputs a toolbar on page view.
By default, most methods do nothing ( self::$enabled = false ). You have to explicitly call MWDebug::init() to enabled them.
Definition at line 33 of file MWDebug.php.
|
static |
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
OutputPage | $out |
Definition at line 120 of file MWDebug.php.
|
static |
Append the debug info to given ApiResult.
IContextSource | $context | |
ApiResult | $result |
Definition at line 504 of file MWDebug.php.
References $context, ApiResult\addValue(), debugMsg(), getDebugInfo(), log(), and ApiResult\setIndexedTagName().
Referenced by ApiMain\executeAction().
|
static |
Clears internal log array and deprecation tracking.
Definition at line 159 of file MWDebug.php.
|
static |
This is a method to pass messages from wfDebug to the pretty debugger.
Do NOT use this method, use MWDebug::log or wfDebug()
string | $str | |
array | $context |
Definition at line 347 of file MWDebug.php.
References $context, $debug, $wgDebugComments, and $wgShowDebug.
Referenced by appendDebugInfoToApiResult(), and MediaWiki\Logger\LegacyLogger\log().
|
static |
Disable the debugger.
Definition at line 109 of file MWDebug.php.
Referenced by RebuildFileCache\finalSetup().
|
static |
Show a warning that $function is deprecated.
This will send it to the following locations:
string | $function | Function that is deprecated. |
string | bool | $version | Version in which the function was deprecated. |
string | bool | $component | Component to which the function belongs. If false, it is assumed the function is in MediaWiki core. |
int | $callerOffset | How far up the callstack is the original caller. 2 = function that called the function that called MWDebug::deprecated() (Added in 1.20). |
Definition at line 217 of file MWDebug.php.
References $wgDeprecationReleaseLimit, $wgDevelopmentWarnings, getCallerDescription(), sendMessage(), and wfBacktrace().
Referenced by wfDeprecated().
|
staticprivate |
Get an array describing the calling function at a specified offset.
int | $callerOffset | How far up the callstack is the original caller. 0 = function that called getCallerDescription() |
Definition at line 290 of file MWDebug.php.
References $file, and wfDebugBacktrace().
Referenced by deprecated(), and warning().
|
static |
Returns the HTML to add to the page for the toolbar.
IContextSource | $context |
Definition at line 444 of file MWDebug.php.
References $context, $debug, $wgDebugComments, getDebugInfo(), and log().
Referenced by TimelessTemplate\execute(), and BaseTemplate\getTrail().
|
static |
Returns the HTML to add to the page for the toolbar.
IContextSource | $context |
Definition at line 538 of file MWDebug.php.
References $context, $debug, $log, $query, $wgVersion, GitInfo\currentBranch(), getFilesIncluded(), GitInfo\headSHA1(), GitInfo\headViewUrl(), GitInfo\isSHA1(), and wfIsHHVM().
Referenced by appendDebugInfoToApiResult(), and getDebugHTML().
|
staticprotected |
Returns a list of files included, along with their size.
IContextSource | $context |
Definition at line 423 of file MWDebug.php.
References $context, and $file.
Referenced by getDebugInfo().
|
static |
Generate debug log in HTML for displaying at the bottom of the main content area.
If $wgShowDebug is false, an empty string is always returned.
Definition at line 478 of file MWDebug.php.
References $debug, $line, and $wgShowDebug.
Referenced by Skin\generateDebugHTML().
|
static |
Returns internal log array.
Definition at line 151 of file MWDebug.php.
References $log.
|
static |
Enabled the debugger and load resource module.
This is called by Setup.php when $wgDebugToolbar is true.
Definition at line 100 of file MWDebug.php.
Referenced by setup().
|
static |
Adds a line to the log.
mixed | $str |
Definition at line 132 of file MWDebug.php.
References wfGetCaller().
Referenced by appendDebugInfoToApiResult(), and getDebugHTML().
|
static |
Begins profiling on a database query.
string | $sql | |
string | $function | |
float | $runTime | Query run time |
string | $dbhost |
Definition at line 378 of file MWDebug.php.
Referenced by MediaWiki\Logger\LegacyLogger\log().
|
staticprivate |
Send a message to the debug log and optionally also trigger a PHP error, depending on the $level argument.
string | $msg | Message to send |
array | $caller | Caller description get from getCallerDescription() |
string | $group | Log group on which to send the message |
int | bool | $level | Error level to use; set to false to not trigger an error |
Definition at line 329 of file MWDebug.php.
References wfDebugLog().
Referenced by deprecated(), and warning().
|
static |
Definition at line 73 of file MWDebug.php.
References $wgCommandLineMode, $wgDebugToolbar, $wgUseCdn, $wgUseFileCache, and init().
|
static |
Adds a warning entry to the log.
string | $msg | |
int | $callerOffset | |
int | $level | A PHP error level. See sendMessage() |
string | $log | 'production' will always trigger a php error, 'auto' will trigger an error if $wgDevelopmentWarnings is true, and 'debug' will only write to the debug log(s). |
Definition at line 175 of file MWDebug.php.
References $log, $wgDevelopmentWarnings, getCallerDescription(), and sendMessage().
Referenced by XmlDumpWriter\invokeLenient(), MediaWiki\HeaderCallback\warnIfHeadersSent(), wfLogWarning(), wfWarn(), and XmlDumpWriter\writeSlot().
|
staticprotected |
Debug messages from wfDebug().
Definition at line 46 of file MWDebug.php.
Referenced by getDebugInfo().
|
staticprotected |
Array of functions that have already been warned, formatted function-caller to prevent a buttload of warnings.
Definition at line 68 of file MWDebug.php.
|
staticprotected |
Is the debugger enabled?
Definition at line 60 of file MWDebug.php.
|
staticprotected |
Log lines.
Definition at line 39 of file MWDebug.php.
Referenced by getDebugInfo(), getLog(), and warning().
|
staticprotected |
SQL statements of the database queries.
Definition at line 53 of file MWDebug.php.
Referenced by getDebugInfo().