Merge "Log profiling data when tests have finished."
authorHashar <hashar@free.fr>
Mon, 19 Nov 2012 13:12:16 +0000 (13:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 19 Nov 2012 13:12:16 +0000 (13:12 +0000)
1  2 
includes/GlobalFunctions.php

@@@ -1214,9 -1214,18 +1214,18 @@@ function wfLogProfilingData() 
        if ( $wgUser->isItemLoaded( 'id' ) && $wgUser->isAnon() ) {
                $forward .= ' anon';
        }
+       // Command line script uses a FauxRequest object which does not have
+       // any knowledge about an URL and throw an exception instead.
+       try {
+               $requestUrl = $wgRequest->getRequestURL();
+       } catch ( MWException $e ) {
+               $requestUrl = 'n/a';
+       }
        $log = sprintf( "%s\t%04.3f\t%s\n",
                gmdate( 'YmdHis' ), $elapsed,
-               urldecode( $wgRequest->getRequestURL() . $forward ) );
+               urldecode( $requestUrl . $forward ) );
  
        wfErrorLog( $log . $profiler->getOutput(), $wgDebugLogFile );
  }
@@@ -2895,15 -2904,11 +2904,15 @@@ function wfMerge( $old, $mine, $yours, 
        $mytextFile = fopen( $mytextName = tempnam( $td, 'merge-mine-' ), 'w' );
        $yourtextFile = fopen( $yourtextName = tempnam( $td, 'merge-your-' ), 'w' );
  
 -      fwrite( $oldtextFile, $old );
 +      # NOTE: diff3 issues a warning to stderr if any of the files does not end with
 +      #       a newline character. To avoid this, we normalize the trailing whitespace before
 +      #       creating the diff.
 +
 +      fwrite( $oldtextFile, rtrim( $old ) . "\n" );
        fclose( $oldtextFile );
 -      fwrite( $mytextFile, $mine );
 +      fwrite( $mytextFile, rtrim( $mine ) . "\n" );
        fclose( $mytextFile );
 -      fwrite( $yourtextFile, $yours );
 +      fwrite( $yourtextFile, rtrim( $yours ) . "\n" );
        fclose( $yourtextFile );
  
        # Check for a conflict