* to explicitly call MWDebug::init() to enabled them.
*
* @todo Profiler support
+ *
+ * @since 1.19
*/
class MWDebug {
/**
* Enabled the debugger and load resource module.
* This is called by Setup.php when $wgDebugToolbar is true.
+ *
+ * @since 1.19
*/
public static function init() {
self::$enabled = true;
* Add ResourceLoader modules to the OutputPage object if debugging is
* enabled.
*
+ * @since 1.19
* @param $out OutputPage
*/
public static function addModules( OutputPage $out ) {
*
* @todo Add support for passing objects
*
+ * @since 1.19
* @param $str string
*/
public static function log( $str ) {
/**
* Returns internal log array
+ * @since 1.19
* @return array
*/
public static function getLog() {
/**
* Clears internal log array and deprecation tracking
+ * @since 1.19
*/
public static function clearLog() {
self::$log = array();
/**
* Adds a warning entry to the log
*
+ * @since 1.19
* @param $msg
* @param int $callerOffset
* @return mixed
// Check to see if there was already a deprecation notice, so not to
// get a duplicate warning
$logCount = count( self::$log );
+ $caller = wfGetCaller( $callerOffset + 1 );
if ( $logCount ) {
$lastLog = self::$log[ $logCount - 1 ];
- if ( $lastLog['type'] == 'deprecated' && $lastLog['caller'] == wfGetCaller( $callerOffset + 1 ) ) {
+ if ( $lastLog['type'] == 'deprecated' && $lastLog['caller'] == $caller ) {
return;
}
}
self::$log[] = array(
'msg' => htmlspecialchars( $msg ),
'type' => 'warn',
- 'caller' => wfGetCaller( $callerOffset ),
+ 'caller' => $caller,
);
}
/**
* Adds a depreciation entry to the log, along with a backtrace
*
+ * @since 1.19
* @param $function
* @param $version
* @param $component
* 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
* @param $str string
*/
public static function debugMsg( $str ) {
/**
* Begins profiling on a database query
*
+ * @since 1.19
* @param $sql string
* @param $function string
* @param $isMaster bool
/**
* Calculates how long a query took.
*
+ * @since 1.19
* @param $id int
*/
public static function queryTime( $id ) {
/**
* Returns the HTML to add to the page for the toolbar
*
+ * @since 1.19
* @param $context IContextSource
* @return string
*/