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