Merge "Kill Dwimmerlaik"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 7 Apr 2015 20:10:21 +0000 (20:10 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 7 Apr 2015 20:10:21 +0000 (20:10 +0000)
1  2 
api.php
includes/MediaWiki.php

diff --combined api.php
+++ b/api.php
@@@ -30,8 -30,6 +30,8 @@@
   * @file
   */
  
 +use MediaWiki\Logger\LegacyLogger;
 +
  // So extensions (and other code) can check whether they're running in API mode
  define( 'MW_API', true );
  
@@@ -61,7 -59,7 +61,7 @@@ if ( !$wgEnableAPI ) 
  
  // Set a dummy $wgTitle, because $wgTitle == null breaks various things
  // In a perfect world this wouldn't be necessary
- $wgTitle = Title::makeTitle( NS_MAIN, 'API' );
+ $wgTitle = Title::makeTitle( NS_SPECIAL, 'Badtitle/dummy title for API calls set in api.php' );
  
  // RequestContext will read from $wgTitle, but it will also whine about it.
  // In a perfect world this wouldn't be necessary either.
@@@ -126,7 -124,7 +126,7 @@@ if ( $wgAPIRequestLog ) 
        } else {
                $items[] = "failed in ApiBeforeMain";
        }
 -      MWLoggerLegacyLogger::emit( implode( ',', $items ) . "\n", $wgAPIRequestLog );
 +      LegacyLogger::emit( implode( ',', $items ) . "\n", $wgAPIRequestLog );
        wfDebug( "Logged API request to $wgAPIRequestLog\n" );
  }
  
diff --combined includes/MediaWiki.php
@@@ -20,8 -20,6 +20,8 @@@
   * @file
   */
  
 +use MediaWiki\Logger\LoggerFactory;
 +
  /**
   * The MediaWiki class is the helper class for the index.php entry point.
   */
@@@ -464,7 -462,9 +464,9 @@@ class MediaWiki 
                // Send Ajax requests to the Ajax dispatcher.
                if ( $this->config->get( 'UseAjax' ) && $request->getVal( 'action' ) === 'ajax' ) {
                        // Set a dummy title, because $wgTitle == null might break things
-                       $title = Title::makeTitle( NS_MAIN, 'AJAX' );
+                       $title = Title::makeTitle( NS_SPECIAL, 'Badtitle/performing an AJAX call in '
+                               . __METHOD__
+                       );
                        $this->context->setTitle( $title );
                        $wgTitle = $title;
  
                $wgTitle = $title;
  
                $trxProfiler = Profiler::instance()->getTransactionProfiler();
 -              $trxProfiler->setLogger( MWLoggerFactory::getInstance( 'DBPerformance' ) );
 +              $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) );
  
                // Aside from rollback, master queries should not happen on GET requests.
                // Periodic or "in passing" updates on GET should use the job queue.
                                        wfDebugLog( 'RedirectedPosts', "Redirected from HTTP to HTTPS: $oldUrl" );
                                }
                                // Setup dummy Title, otherwise OutputPage::redirect will fail
 -                              $title = Title::newFromText( NS_MAIN, 'REDIR' );
 +                              $title = Title::newFromText( 'REDIR', NS_MAIN );
                                $this->context->setTitle( $title );
                                $output = $this->context->getOutput();
                                // Since we only do this redir to change proto, always send a vary header
                        $n = intval( $jobRunRate );
                }
  
 -              $runJobsLogger = MWLoggerFactory::getInstance( 'runJobs' );
 +              $runJobsLogger = LoggerFactory::getInstance( 'runJobs' );
  
                if ( !$this->config->get( 'RunJobsAsync' ) ) {
                        // Fall back to running the job here while the user waits
                }
  
                $url = wfAppendQuery( wfScript( 'index' ), $query );
 -              $req = "POST $url HTTP/1.1\r\nHost: {$info['host']}\r\nConnection: Close\r\nContent-Length: 0\r\n\r\n";
 +              $req = (
 +                      "POST $url HTTP/1.1\r\n" .
 +                      "Host: {$info['host']}\r\n" .
 +                      "Connection: Close\r\n" .
 +                      "Content-Length: 0\r\n\r\n"
 +              );
  
                $runJobsLogger->info( "Running $n job(s) via '$url'" );
                // Send a cron API request to be performed in the background.