Index: trunk/phase3/includes/debug/Debug.php |
— | — | @@ -32,13 +32,6 @@ |
33 | 33 | protected static $query = array(); |
34 | 34 | |
35 | 35 | /** |
36 | | - * Request information |
37 | | - * |
38 | | - * @var array |
39 | | - */ |
40 | | - protected static $request = array(); |
41 | | - |
42 | | - /** |
43 | 36 | * Is the debugger enabled? |
44 | 37 | * |
45 | 38 | * @var bool |
— | — | @@ -59,10 +52,21 @@ |
60 | 53 | */ |
61 | 54 | public static function init() { |
62 | 55 | self::$enabled = true; |
63 | | - RequestContext::getMain()->getOutput()->addModules( 'mediawiki.debug' ); |
64 | 56 | } |
65 | 57 | |
66 | 58 | /** |
| 59 | + * Add ResourceLoader modules to the OutputPage object if debugging is |
| 60 | + * enabled. |
| 61 | + * |
| 62 | + * @param $out OutputPage |
| 63 | + */ |
| 64 | + public static function addModules( OutputPage $out ) { |
| 65 | + if ( self::$enabled ) { |
| 66 | + $out->addModules( 'mediawiki.debug' ); |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + /** |
67 | 71 | * Adds a line to the log |
68 | 72 | * |
69 | 73 | * @todo Add support for passing objects |
— | — | @@ -217,24 +221,6 @@ |
218 | 222 | } |
219 | 223 | |
220 | 224 | /** |
221 | | - * Processes a WebRequest object |
222 | | - * |
223 | | - * @param $request WebRequest |
224 | | - */ |
225 | | - public static function processRequest( WebRequest $request ) { |
226 | | - if ( !self::$enabled ) { |
227 | | - return; |
228 | | - } |
229 | | - |
230 | | - self::$request = array( |
231 | | - 'method' => $_SERVER['REQUEST_METHOD'], |
232 | | - 'url' => $request->getRequestURL(), |
233 | | - 'headers' => $request->getAllHeaders(), |
234 | | - 'params' => $request->getValues(), |
235 | | - ); |
236 | | - } |
237 | | - |
238 | | - /** |
239 | 225 | * Returns a list of files included, along with their size |
240 | 226 | * |
241 | 227 | * @param $context IContextSource |
— | — | @@ -267,6 +253,7 @@ |
268 | 254 | |
269 | 255 | global $wgVersion, $wgRequestTime; |
270 | 256 | MWDebug::log( 'MWDebug output complete' ); |
| 257 | + $request = $context->getRequest(); |
271 | 258 | $debugInfo = array( |
272 | 259 | 'mwVersion' => $wgVersion, |
273 | 260 | 'phpVersion' => PHP_VERSION, |
— | — | @@ -274,7 +261,12 @@ |
275 | 262 | 'log' => self::$log, |
276 | 263 | 'debugLog' => self::$debug, |
277 | 264 | 'queries' => self::$query, |
278 | | - 'request' => self::$request, |
| 265 | + 'request' => array( |
| 266 | + 'method' => $_SERVER['REQUEST_METHOD'], |
| 267 | + 'url' => $request->getRequestURL(), |
| 268 | + 'headers' => $request->getAllHeaders(), |
| 269 | + 'params' => $request->getValues(), |
| 270 | + ), |
279 | 271 | 'memory' => $context->getLanguage()->formatSize( memory_get_usage() ), |
280 | 272 | 'memoryPeak' => $context->getLanguage()->formatSize( memory_get_peak_usage() ), |
281 | 273 | 'includes' => self::getFilesIncluded( $context ), |
Index: trunk/phase3/includes/Setup.php |
— | — | @@ -427,7 +427,6 @@ |
428 | 428 | } |
429 | 429 | } |
430 | 430 | wfDebug( "$debug\n" ); |
431 | | - MWDebug::processRequest( $wgRequest ); |
432 | 431 | } |
433 | 432 | |
434 | 433 | wfProfileOut( $fname . '-misc1' ); |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2456,6 +2456,8 @@ |
2457 | 2457 | $this->addModules( 'mediawiki.util' ); |
2458 | 2458 | } |
2459 | 2459 | |
| 2460 | + MWDebug::addModules( $this ); |
| 2461 | + |
2460 | 2462 | // Add various resources if required |
2461 | 2463 | if ( $wgUseAjax ) { |
2462 | 2464 | $this->addModules( 'mediawiki.legacy.ajax' ); |