|
MediaWiki
REL1_23
|
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. | |
| static | appendDebugInfoToApiResult (IContextSource $context, ApiResult $result) |
| Append the debug info to given ApiResult. | |
| static | clearLog () |
| Clears internal log array and deprecation tracking. | |
| static | debugMsg ($str) |
| This is a method to pass messages from wfDebug to the pretty debugger. | |
| static | deprecated ($function, $version=false, $component=false, $callerOffset=2) |
| Show a warning that $function is deprecated. | |
| static | getDebugHTML (IContextSource $context) |
| Returns the HTML to add to the page for the toolbar. | |
| static | getDebugInfo (IContextSource $context) |
| Returns the HTML to add to the page for the toolbar. | |
| static | getHTMLDebugLog () |
| Generate debug log in HTML for displaying at the bottom of the main content area. | |
| static | getLog () |
| Returns internal log array. | |
| static | init () |
| Enabled the debugger and load resource module. | |
| static | log ($str) |
| Adds a line to the log. | |
| static | query ($sql, $function, $isMaster) |
| Begins profiling on a database query. | |
| static | queryTime ($id) |
| Calculates how long a query took. | |
| static | warning ($msg, $callerOffset=1, $level=E_USER_NOTICE, $log= 'auto') |
| Adds a warning entry to the log. | |
Static Protected Member Functions | |
| static | getFilesIncluded (IContextSource $context) |
| Returns a list of files included, along with their size. | |
Static Protected Attributes | |
| static | $debug = array() |
| Debug messages from wfDebug(). | |
| static | $deprecationWarnings = array() |
| Array of functions that have already been warned, formatted function-caller to prevent a buttload of warnings. | |
| static | $enabled = false |
| Is the debugger enabled? | |
| static | $log = array() |
| Log lines. | |
| static | $query = array() |
| SQL statements of the databses queries. | |
Static Private Member Functions | |
| static | getCallerDescription ($callerOffset) |
| Get an array describing the calling function at a specified offset. | |
| 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. | |
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.
| static MWDebug::addModules | ( | OutputPage $ | out | ) | [static] |
Add ResourceLoader modules to the OutputPage object if debugging is enabled.
| $out | OutputPage |
Definition at line 87 of file Debug.php.
References OutputPage\addModules().
| static MWDebug::appendDebugInfoToApiResult | ( | IContextSource $ | context, |
| ApiResult $ | result | ||
| ) | [static] |
Append the debug info to given ApiResult.
| $context | IContextSource |
| $result | ApiResult |
Definition at line 491 of file Debug.php.
References ApiResult\addValue(), as, debugMsg(), getDebugInfo(), log(), ApiResult\setIndexedTagName(), and Sanitizer\stripAllTags().
| static MWDebug::clearLog | ( | ) | [static] |
Clears internal log array and deprecation tracking.
Definition at line 126 of file Debug.php.
References array().
Referenced by MWDebugTest\setUp().
| static MWDebug::debugMsg | ( | $ | str | ) | [static] |
This is a method to pass messages from wfDebug to the pretty debugger.
Do NOT use this method, use MWDebug::log or wfDebug()
| $str | string |
Definition at line 316 of file Debug.php.
References $debug, UtfNormal\cleanUp(), and global.
Referenced by appendDebugInfoToApiResult(), wfDebug(), and wfDebugLog().
| static MWDebug::deprecated | ( | $ | function, |
| $ | version = false, |
||
| $ | component = false, |
||
| $ | callerOffset = 2 |
||
| ) | [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 assumbed the function is in MediaWiki core. |
| $callerOffset | integer: 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 187 of file Debug.php.
References array(), Html\element(), getCallerDescription(), global, Html\rawElement(), sendMessage(), and wfBacktrace().
Referenced by MWDebugTest\testAvoidDuplicateDeprecations(), MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations(), and wfDeprecated().
| static MWDebug::getCallerDescription | ( | $ | callerOffset | ) | [static, private] |
Get an array describing the calling function at a specified offset.
| $callerOffset | integer: How far up the callstack is the original caller. 0 = function that called getCallerDescription() |
Definition at line 260 of file Debug.php.
References $file, array(), and wfDebugBacktrace().
Referenced by deprecated(), and warning().
| static MWDebug::getDebugHTML | ( | IContextSource $ | context | ) | [static] |
Returns the HTML to add to the page for the toolbar.
| $context | IContextSource |
Definition at line 392 of file Debug.php.
References $debug, $html, array(), getDebugInfo(), global, Html\inlineScript(), log(), ResourceLoader\makeConfigSetScript(), and ResourceLoader\makeLoaderConditionalScript().
Referenced by BaseTemplate\printTrail().
| static MWDebug::getDebugInfo | ( | IContextSource $ | context | ) | [static] |
Returns the HTML to add to the page for the toolbar.
| $context | IContextSource |
Definition at line 525 of file Debug.php.
References $debug, $query, $wgRequestTime, array(), GitInfo\currentBranch(), getFilesIncluded(), IContextSource\getLanguage(), IContextSource\getRequest(), global, GitInfo\headSHA1(), GitInfo\headViewUrl(), Profiler\instance(), and wfIsHHVM().
Referenced by appendDebugInfoToApiResult(), and getDebugHTML().
| static MWDebug::getFilesIncluded | ( | IContextSource $ | context | ) | [static, protected] |
Returns a list of files included, along with their size.
| $context | IContextSource |
Definition at line 371 of file Debug.php.
References $file, $files, $size, array(), as, and IContextSource\getLanguage().
Referenced by getDebugInfo().
| static MWDebug::getHTMLDebugLog | ( | ) | [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 427 of file Debug.php.
References $debug, $matches, $pre, $ret, array(), as, and global.
Referenced by Skin\generateDebugHTML().
| static MWDebug::getLog | ( | ) | [static] |
Returns internal log array.
Definition at line 118 of file Debug.php.
References $log.
Referenced by MWDebugTest\testAddLog(), MWDebugTest\testAddWarning(), MWDebugTest\testAvoidDuplicateDeprecations(), and MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations().
| static MWDebug::init | ( | ) | [static] |
Enabled the debugger and load resource module.
This is called by Setup.php when $wgDebugToolbar is true.
Definition at line 76 of file Debug.php.
Referenced by MWDebugTest\setUp().
| static MWDebug::log | ( | $ | str | ) | [static] |
Adds a line to the log.
| $str | string |
Definition at line 101 of file Debug.php.
References array(), and wfGetCaller().
Referenced by appendDebugInfoToApiResult(), getDebugHTML(), MWDebugTest\testAddLog(), and MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations().
| static MWDebug::query | ( | $ | sql, |
| $ | function, | ||
| $ | isMaster | ||
| ) | [static] |
| static MWDebug::queryTime | ( | $ | id | ) | [static] |
| static MWDebug::sendMessage | ( | $ | msg, |
| $ | caller, | ||
| $ | group, | ||
| $ | level | ||
| ) | [static, private] |
Send a message to the debug log and optionally also trigger a PHP error, depending on the $level argument.
| $msg | string Message to send |
| $caller | array caller description get from getCallerDescription() |
| $group | string log group on which to send the message |
| $level | int|bool error level to use; set to false to not trigger an error |
Definition at line 299 of file Debug.php.
References wfDebugLog().
Referenced by deprecated(), and warning().
| static MWDebug::warning | ( | $ | msg, |
| $ | callerOffset = 1, |
||
| $ | level = E_USER_NOTICE, |
||
| $ | log = 'auto' |
||
| ) | [static] |
Adds a warning entry to the log.
| $msg | string |
| $callerOffset | int |
| $level | int A PHP error level. See sendMessage() |
| $log | string: '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 144 of file Debug.php.
References $log, array(), getCallerDescription(), global, and sendMessage().
Referenced by MWDebugTest\testAddWarning(), MWDebugTest\testAvoidNonConsecutivesDuplicateDeprecations(), wfLogWarning(), and wfWarn().
bool MWDebug::$enabled = false [static, protected] |