Index: trunk/phase3/includes/resourceloader/ResourceLoader.php |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | $cache->set( $key, $result ); |
157 | 157 | } catch ( Exception $exception ) { |
158 | 158 | // Return exception as a comment |
159 | | - $result = "/*\n{$exception->__toString()}\n*/"; |
| 159 | + $result = "/*\n{$exception->__toString()}\n*/\n"; |
160 | 160 | } |
161 | 161 | |
162 | 162 | wfProfileOut( __METHOD__ ); |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | ob_start(); |
295 | 295 | |
296 | 296 | wfProfileIn( __METHOD__ ); |
297 | | - $response = ''; |
| 297 | + $exceptions = ''; |
298 | 298 | |
299 | 299 | // Split requested modules into two groups, modules and missing |
300 | 300 | $modules = array(); |
— | — | @@ -324,7 +324,7 @@ |
325 | 325 | $this->preloadModuleInfo( array_keys( $modules ), $context ); |
326 | 326 | } catch( Exception $e ) { |
327 | 327 | // Add exception to the output as a comment |
328 | | - $response .= "/*\n{$e->__toString()}\n*/"; |
| 328 | + $exceptions .= "/*\n{$e->__toString()}\n*/\n"; |
329 | 329 | } |
330 | 330 | |
331 | 331 | wfProfileIn( __METHOD__.'-getModifiedTime' ); |
— | — | @@ -342,7 +342,7 @@ |
343 | 343 | $mtime = max( $mtime, $module->getModifiedTime( $context ) ); |
344 | 344 | } catch ( Exception $e ) { |
345 | 345 | // Add exception to the output as a comment |
346 | | - $response .= "/*\n{$e->__toString()}\n*/"; |
| 346 | + $exceptions .= "/*\n{$e->__toString()}\n*/\n"; |
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
— | — | @@ -393,12 +393,15 @@ |
394 | 394 | } |
395 | 395 | |
396 | 396 | // Generate a response |
397 | | - $response .= $this->makeModuleResponse( $context, $modules, $missing ); |
| 397 | + $response = $this->makeModuleResponse( $context, $modules, $missing ); |
| 398 | + |
| 399 | + // Prepend comments indicating exceptions |
| 400 | + $response = $exceptions . $response; |
398 | 401 | |
399 | 402 | // Capture any PHP warnings from the output buffer and append them to the |
400 | 403 | // response in a comment if we're in debug mode. |
401 | 404 | if ( $context->getDebug() && strlen( $warnings = ob_get_contents() ) ) { |
402 | | - $response .= "/*\n$warnings\n*/"; |
| 405 | + $response = "/*\n$warnings\n*/\n" . $response; |
403 | 406 | } |
404 | 407 | |
405 | 408 | // Remove the output buffer and output the response |
— | — | @@ -420,18 +423,19 @@ |
421 | 424 | array $modules, $missing = array() ) |
422 | 425 | { |
423 | 426 | $out = ''; |
| 427 | + $exceptions = ''; |
424 | 428 | if ( $modules === array() && $missing === array() ) { |
425 | 429 | return '/* No modules requested. Max made me put this here */'; |
426 | 430 | } |
427 | 431 | |
428 | 432 | // Pre-fetch blobs |
429 | 433 | if ( $context->shouldIncludeMessages() ) { |
430 | | - //try { |
| 434 | + try { |
431 | 435 | $blobs = MessageBlobStore::get( $this, $modules, $context->getLanguage() ); |
432 | | - //} catch ( Exception $e ) { |
| 436 | + } catch ( Exception $e ) { |
433 | 437 | // Add exception to the output as a comment |
434 | | - // $out .= "/*\n{$e->__toString()}\n*/"; |
435 | | - //} |
| 438 | + $exceptions .= "/*\n{$e->__toString()}\n*/\n"; |
| 439 | + } |
436 | 440 | } else { |
437 | 441 | $blobs = array(); |
438 | 442 | } |
— | — | @@ -480,7 +484,7 @@ |
481 | 485 | } |
482 | 486 | } catch ( Exception $e ) { |
483 | 487 | // Add exception to the output as a comment |
484 | | - $out .= "/*\n{$e->__toString()}\n*/"; |
| 488 | + $exceptions .= "/*\n{$e->__toString()}\n*/\n"; |
485 | 489 | |
486 | 490 | // Register module as missing |
487 | 491 | $missing[] = $name; |
— | — | @@ -505,12 +509,12 @@ |
506 | 510 | } |
507 | 511 | |
508 | 512 | if ( $context->getDebug() ) { |
509 | | - return $out; |
| 513 | + return $exceptions . $out; |
510 | 514 | } else { |
511 | 515 | if ( $context->getOnly() === 'styles' ) { |
512 | | - return $this->filter( 'minify-css', $out ); |
| 516 | + return $exceptions . $this->filter( 'minify-css', $out ); |
513 | 517 | } else { |
514 | | - return $this->filter( 'minify-js', $out ); |
| 518 | + return $exceptions . $this->filter( 'minify-js', $out ); |
515 | 519 | } |
516 | 520 | } |
517 | 521 | } |