BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
MWDebug Class Reference

Static Public Member Functions

static init ()
 
static addModules (OutputPage $out)
 
static log ($str)
 
static getLog ()
 
static clearLog ()
 
static warning ($msg, $callerOffset=1, $level=E_USER_NOTICE, $log= 'auto')
 
static deprecated ($function, $version=false, $component=false, $callerOffset=2)
 
static debugMsg ($str, $context=[])
 
static query ($sql, $function, $isMaster)
 
static queryTime ($id)
 
static getDebugHTML (IContextSource $context)
 
static getHTMLDebugLog ()
 
static appendDebugInfoToApiResult (IContextSource $context, ApiResult $result)
 
static getDebugInfo (IContextSource $context)
 

Static Protected Member Functions

static getFilesIncluded (IContextSource $context)
 

Static Protected Attributes

static $log = []
 
static $debug = []
 
static $query = []
 
static $enabled = false
 
static $deprecationWarnings = []
 

Detailed Description

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.

Since
1.19

Member Function Documentation

static MWDebug::addModules ( OutputPage  $out)
static

Add ResourceLoader modules to the OutputPage object if debugging is enabled.

Since
1.19
Parameters
OutputPage$out
static MWDebug::appendDebugInfoToApiResult ( IContextSource  $context,
ApiResult  $result 
)
static

Append the debug info to given ApiResult

Parameters
IContextSource$context
ApiResult$result
static MWDebug::clearLog ( )
static

Clears internal log array and deprecation tracking

Since
1.19
static MWDebug::debugMsg (   $str,
  $context = [] 
)
static

This is a method to pass messages from wfDebug to the pretty debugger. Do NOT use this method, use MWDebug::log or wfDebug()

Since
1.19
Parameters
string$str
array$context
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:

  • Debug toolbar, with one item per function and caller, if $wgDebugToolbar is set to true.
  • PHP's error log, with level E_USER_DEPRECATED, if $wgDevelopmentWarnings is set to true.
  • MediaWiki's debug log, if $wgDevelopmentWarnings is set to false.
Since
1.19
Parameters
string$functionFunction that is deprecated.
string | bool$versionVersion in which the function was deprecated.
string | bool$componentComponent to which the function belongs. If false, it is assumbed the function is in MediaWiki core.
int$callerOffsetHow far up the callstack is the original caller. 2 = function that called the function that called MWDebug::deprecated() (Added in 1.20).
static MWDebug::getDebugHTML ( IContextSource  $context)
static

Returns the HTML to add to the page for the toolbar

Since
1.19
Parameters
IContextSource$context
Returns
string
static MWDebug::getDebugInfo ( IContextSource  $context)
static

Returns the HTML to add to the page for the toolbar

Parameters
IContextSource$context
Returns
array
static MWDebug::getFilesIncluded ( IContextSource  $context)
staticprotected

Returns a list of files included, along with their size

Parameters
IContextSource$context
Returns
array
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.

Since
1.20
Returns
string HTML fragment
static MWDebug::getLog ( )
static

Returns internal log array

Since
1.19
Returns
array
static MWDebug::init ( )
static

Enabled the debugger and load resource module. This is called by Setup.php when $wgDebugToolbar is true.

Since
1.19
static MWDebug::log (   $str)
static

Adds a line to the log

Since
1.19
Parameters
mixed$str
static MWDebug::query (   $sql,
  $function,
  $isMaster 
)
static

Begins profiling on a database query

Since
1.19
Parameters
string$sql
string$function
bool$isMaster
Returns
int ID number of the query to pass to queryTime or -1 if the debugger is disabled
static MWDebug::queryTime (   $id)
static

Calculates how long a query took.

Since
1.19
Parameters
int$id
static MWDebug::warning (   $msg,
  $callerOffset = 1,
  $level = E_USER_NOTICE,
  $log = 'auto' 
)
static

Adds a warning entry to the log

Since
1.19
Parameters
string$msg
int$callerOffset
int$levelA 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).
Returns
mixed

Member Data Documentation

array MWDebug::$debug = []
staticprotected

Debug messages from wfDebug().

array MWDebug::$deprecationWarnings = []
staticprotected

Array of functions that have already been warned, formatted function-caller to prevent a buttload of warnings

bool MWDebug::$enabled = false
staticprotected

Is the debugger enabled?

array MWDebug::$log = []
staticprotected

Log lines

array MWDebug::$query = []
staticprotected

SQL statements of the database queries.


The documentation for this class was generated from the following file: