Index: trunk/phase3/includes/profiler/Profiler.php |
— | — | @@ -34,12 +34,10 @@ |
35 | 35 | * @todo document |
36 | 36 | */ |
37 | 37 | class Profiler { |
38 | | - var $mStack = array (), $mWorkStack = array (), $mCollated = array (); |
39 | | - var $mCalls = array (), $mTotals = array (); |
40 | | - var $mTemplated = false; |
41 | | - var $mTimeMetric = 'wall'; |
42 | | - private $mCollateDone = false; |
43 | | - protected $mProfileID = false; |
| 38 | + protected $mStack = array(), $mWorkStack = array (), $mCollated = array (), |
| 39 | + $mCalls = array (), $mTotals = array (); |
| 40 | + protected $mTimeMetric = 'wall'; |
| 41 | + protected $mProfileID = false, $mCollateDone = false, $mTemplated = false; |
44 | 42 | private static $__instance = null; |
45 | 43 | |
46 | 44 | function __construct( $params ) { |
— | — | @@ -54,6 +52,9 @@ |
55 | 53 | if ( isset( $params['timeMetric'] ) ) { |
56 | 54 | $this->mTimeMetric = $params['timeMetric']; |
57 | 55 | } |
| 56 | + if ( isset( $params['profileID'] ) ) { |
| 57 | + $this->mProfileID = $params['profileID']; |
| 58 | + } |
58 | 59 | } |
59 | 60 | |
60 | 61 | /** |
— | — | @@ -64,11 +65,19 @@ |
65 | 66 | if( is_null( self::$__instance ) ) { |
66 | 67 | global $wgProfiler; |
67 | 68 | if( is_array( $wgProfiler ) ) { |
68 | | - $class = isset( $wgProfiler['class'] ) ? $wgProfiler['class'] : 'ProfilerStub'; |
| 69 | + if( !isset( $wgProfiler['class'] ) ) { |
| 70 | + wfDebug( __METHOD__ . " called without \$wgProfiler['class']" |
| 71 | + . ' set, falling back to ProfilerStub for safety' ); |
| 72 | + $class = 'ProfilerStub'; |
| 73 | + } else { |
| 74 | + $class = $wgProfiler['class']; |
| 75 | + } |
69 | 76 | self::$__instance = new $class( $wgProfiler ); |
70 | 77 | } elseif( $wgProfiler instanceof Profiler ) { |
71 | 78 | self::$__instance = $wgProfiler; // back-compat |
72 | 79 | } else { |
| 80 | + wfDebug( __METHOD__ . ' called without bogus $wgProfiler setting,' |
| 81 | + . ' falling back to ProfilerStub for safety' ); |
73 | 82 | self::$__instance = new ProfilerStub( $wgProfiler ); |
74 | 83 | } |
75 | 84 | } |