Merge "ResourceLoaderImage: Allow shorthand syntax"
[lhc/web/wiklou.git] / includes / MediaWiki.php
index c21f5e9..68d03c8 100644 (file)
  * @file
  */
 
+use MediaWiki\Logger\LoggerFactory;
+
 /**
  * The MediaWiki class is the helper class for the index.php entry point.
- *
- * @internal documentation reviewed 15 Mar 2010
  */
 class MediaWiki {
        /**
@@ -201,8 +201,6 @@ class MediaWiki {
                        throw new PermissionsError( 'read', $permErrors );
                }
 
-               $pageView = false; // was an article or special page viewed?
-
                // Interwiki redirects
                if ( $title->isExternal() ) {
                        $rdfrom = $request->getVal( 'rdfrom' );
@@ -265,7 +263,6 @@ class MediaWiki {
                        }
                // Special pages
                } elseif ( NS_SPECIAL == $title->getNamespace() ) {
-                       $pageView = true;
                        // Actions that need to be made when we have a special pages
                        SpecialPageFactory::executePath( $title, $this->context );
                } else {
@@ -273,7 +270,6 @@ class MediaWiki {
                        // may be a redirect to another article or URL.
                        $article = $this->initializeArticle();
                        if ( is_object( $article ) ) {
-                               $pageView = true;
                                $this->performAction( $article, $requestTitle );
                        } elseif ( is_string( $article ) ) {
                                $output->redirect( $article );
@@ -282,12 +278,6 @@ class MediaWiki {
                                        . " returned neither an object nor a URL" );
                        }
                }
-
-               if ( $pageView ) {
-                       // Promote user to any groups they meet the criteria for
-                       $user->addAutopromoteOnceGroups( 'onView' );
-               }
-
        }
 
        /**
@@ -489,14 +479,17 @@ class MediaWiki {
                $action = $this->getAction();
                $wgTitle = $title;
 
+               $trxProfiler = Profiler::instance()->getTransactionProfiler();
+               $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.
                if ( !$request->wasPosted()
                        && in_array( $action, array( 'view', 'edit', 'history' ) )
                ) {
-                       $trxProfiler = Profiler::instance()->getTransactionProfiler();
                        $trxProfiler->setExpectation( 'masterConns', 0, __METHOD__ );
                        $trxProfiler->setExpectation( 'writes', 0, __METHOD__ );
+               } else {
                        $trxProfiler->setExpectation( 'maxAffected', 500, __METHOD__ );
                }
 
@@ -627,7 +620,7 @@ class MediaWiki {
                        $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
@@ -672,7 +665,12 @@ class MediaWiki {
                }
 
                $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.