Merge "languages: Backtick "<em>" since it's meant as code instead of mark up"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 2 Apr 2015 22:37:52 +0000 (22:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 2 Apr 2015 22:37:52 +0000 (22:37 +0000)
12 files changed:
includes/DefaultSettings.php
includes/MediaWiki.php
includes/MessageBlobStore.php
includes/cache/LocalisationCache.php
includes/cache/MessageCache.php
includes/installer/DatabaseUpdater.php
includes/logging/LogFormatter.php
includes/profiler/TransactionProfiler.php
includes/resourceloader/ResourceLoader.php
maintenance/Doxyfile
maintenance/mwdocgen.php
tests/phpunit/includes/OutputPageTest.php

index 5e81d0f..ef80c63 100644 (file)
@@ -52,6 +52,8 @@ if ( !defined( 'MEDIAWIKI' ) ) {
        die( 1 );
 }
 
+/** @endcond */
+
 /**
  * wgConf hold the site configuration.
  * Not used for much in a default install.
index c086a39..c4af16d 100644 (file)
@@ -478,6 +478,7 @@ class MediaWiki {
                $wgTitle = $title;
 
                $trxProfiler = Profiler::instance()->getTransactionProfiler();
+               $trxProfiler->setLogger( MWLoggerFactory::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.
index c384188..011cae6 100644 (file)
@@ -36,15 +36,12 @@ class MessageBlobStore {
         * Get the singleton instance
         *
         * @since 1.24
+        * @deprecated since 1.25
         * @return MessageBlobStore
         */
        public static function getInstance() {
-               static $instance = null;
-               if ( $instance === null ) {
-                       $instance = new self;
-               }
-
-               return $instance;
+               wfDeprecated( __METHOD__, '1.25' );
+               return new self;
        }
 
        /**
index e270f5f..dc5a2eb 100644 (file)
@@ -1020,7 +1020,8 @@ class LocalisationCache {
                # HACK: If using a null (i.e. disabled) storage backend, we
                # can't write to the MessageBlobStore either
                if ( $purgeBlobs && !$this->store instanceof LCStoreNull ) {
-                       MessageBlobStore::getInstance()->clear();
+                       $blobStore = new MessageBlobStore();
+                       $blobStore->clear();
                }
 
        }
index 04f5887..82919c7 100644 (file)
@@ -562,7 +562,8 @@ class MessageCache {
 
                // Update the message in the message blob store
                global $wgContLang;
-               MessageBlobStore::getInstance()->updateMessage( $wgContLang->lcfirst( $msg ) );
+               $blobStore = new MessageBlobStore();
+               $blobStore->updateMessage( $wgContLang->lcfirst( $msg ) );
 
                Hooks::run( 'MessageCacheReplace', array( $title, $text ) );
 
index b676f45..12ef91a 100644 (file)
@@ -932,7 +932,8 @@ abstract class DatabaseUpdater {
                if ( $wgLocalisationCacheConf['manualRecache'] ) {
                        $this->rebuildLocalisationCache();
                }
-               MessageBlobStore::getInstance()->clear();
+               $blobStore = new MessageBlobStore();
+               $blobStore->clear();
                $this->output( "done.\n" );
        }
 
index 267a319..cf9fb53 100644 (file)
 
 /**
  * Implements the default log formatting.
- * Can be overridden by subclassing and setting
- * $wgLogActionsHandlers['type/subtype'] = 'class'; or
- * $wgLogActionsHandlers['type/*'] = 'class';
+ *
+ * Can be overridden by subclassing and setting:
+ *
+ *     $wgLogActionsHandlers['type/subtype'] = 'class'; or
+ *     $wgLogActionsHandlers['type/*'] = 'class';
+ *
  * @since 1.19
  */
 class LogFormatter {
index b313558..baec181 100644 (file)
@@ -22,6 +22,9 @@
  * @author Aaron Schulz
  */
 
+use Psr\Log\LoggerInterface;
+use Psr\Log\LoggerAwareInterface;
+use Psr\Log\NullLogger;
 /**
  * Helper class that detects high-contention DB queries via profiling calls
  *
@@ -29,7 +32,7 @@
  *
  * @since 1.24
  */
-class TransactionProfiler {
+class TransactionProfiler implements LoggerAwareInterface {
        /** @var float Seconds */
        protected $dbLockThreshold = 3.0;
        /** @var float Seconds */
@@ -58,6 +61,19 @@ class TransactionProfiler {
        /** @var array */
        protected $expectBy = array();
 
+       /**
+        * @var LoggerInterface
+        */
+       private $logger;
+
+       public function __construct() {
+               $this->setLogger( new NullLogger() );
+       }
+
+       public function setLogger( LoggerInterface $logger ) {
+               $this->logger = $logger;
+       }
+
        /**
         * Set performance expectations
         *
@@ -125,7 +141,7 @@ class TransactionProfiler {
        public function transactionWritingIn( $server, $db, $id ) {
                $name = "{$server} ({$db}) (TRX#$id)";
                if ( isset( $this->dbTrxHoldingLocks[$name] ) ) {
-                       wfDebugLog( 'DBPerformance', "Nested transaction for '$name' - out of sync." );
+                       $this->logger->info( "Nested transaction for '$name' - out of sync." );
                }
                $this->dbTrxHoldingLocks[$name] = array(
                        'start' => microtime( true ),
@@ -154,8 +170,7 @@ class TransactionProfiler {
                $elapsed = ( $eTime - $sTime );
 
                if ( $isWrite && $n > $this->expect['maxAffected'] ) {
-                       wfDebugLog( 'DBPerformance',
-                               "Query affected $n row(s):\n" . $query . "\n" . wfBacktrace( true ) );
+                       $this->logger->info( "Query affected $n row(s):\n" . $query . "\n" . wfBacktrace( true ) );
                }
 
                // Report when too many writes/queries happen...
@@ -209,7 +224,7 @@ class TransactionProfiler {
        public function transactionWritingOut( $server, $db, $id ) {
                $name = "{$server} ({$db}) (TRX#$id)";
                if ( !isset( $this->dbTrxMethodTimes[$name] ) ) {
-                       wfDebugLog( 'DBPerformance', "Detected no transaction for '$name' - out of sync." );
+                       $this->logger->info( "Detected no transaction for '$name' - out of sync." );
                        return;
                }
                // Fill in the last non-query period...
@@ -237,7 +252,7 @@ class TransactionProfiler {
                                list( $query, $sTime, $end ) = $info;
                                $msg .= sprintf( "%d\t%.6f\t%s\n", $i, ( $end - $sTime ), $query );
                        }
-                       wfDebugLog( 'DBPerformance', $msg );
+                       $this->logger->info( $msg );
                }
                unset( $this->dbTrxHoldingLocks[$name] );
                unset( $this->dbTrxMethodTimes[$name] );
@@ -250,7 +265,8 @@ class TransactionProfiler {
        protected function reportExpectationViolated( $expect, $query ) {
                $n = $this->expect[$expect];
                $by = $this->expectBy[$expect];
-               wfDebugLog( 'DBPerformance',
-                       "Expectation ($expect <= $n) by $by not met:\n$query\n" . wfBacktrace( true ) );
+               $this->logger->info(
+                       "Expectation ($expect <= $n) by $by not met:\n$query\n" . wfBacktrace( true )
+               );
        }
 }
index 5eab3cb..b9d1b2b 100644 (file)
@@ -72,6 +72,11 @@ class ResourceLoader {
         */
        protected $errors = array();
 
+       /**
+        * @var MessageBlobStore
+        */
+       protected $blobStore;
+
        /**
         * Load information stored in the database about modules.
         *
@@ -250,6 +255,7 @@ class ResourceLoader {
                        $this->registerTestModules();
                }
 
+               $this->setMessageBlobStore( new MessageBlobStore() );
        }
 
        /**
@@ -259,6 +265,14 @@ class ResourceLoader {
                return $this->config;
        }
 
+       /**
+        * @param MessageBlobStore $blobStore
+        * @since 1.25
+        */
+       public function setMessageBlobStore( MessageBlobStore $blobStore ) {
+               $this->blobStore = $blobStore;
+       }
+
        /**
         * Register a module with the ResourceLoader system.
         *
@@ -885,7 +899,7 @@ MESSAGE;
                // Pre-fetch blobs
                if ( $context->shouldIncludeMessages() ) {
                        try {
-                               $blobs = MessageBlobStore::getInstance()->get( $this, $modules, $context->getLanguage() );
+                               $blobs = $this->blobStore->get( $this, $modules, $context->getLanguage() );
                        } catch ( Exception $e ) {
                                MWExceptionHandler::logException( $e );
                                wfDebugLog(
index 0589009..1f70f45 100644 (file)
@@ -65,7 +65,13 @@ ALIASES                = "type{1}=<b> \1 </b>:" \
                          "public=\access public" \
                          "copyright=\note" \
                          "license=\note" \
-                         "codeCoverageIgnore="
+                         "codeCoverageIgnore=" \
+                         "codingStandardsIgnoreStart=" \
+                         "group=" \
+                         "covers=" \
+                         "dataProvider=" \
+                         "expectedException=" \
+                         "expectedExceptionMessage="
 TCL_SUBST              =
 OPTIMIZE_OUTPUT_FOR_C  = NO
 OPTIMIZE_OUTPUT_JAVA   = NO
index ee0ff01..49eae4a 100644 (file)
@@ -91,6 +91,7 @@ class MWDocGen extends Maintenance {
                $this->template = $IP . '/maintenance/Doxyfile';
                $this->excludes = array(
                        'vendor',
+                       'node_modules',
                        'images',
                        'static',
                );
index 2526fcc..ee6a8cf 100644 (file)
@@ -239,6 +239,7 @@ document.write("\u003Cscript src=\"http://127.0.0.1:8080/w/load.php?debug=false\
                $ctx->setLanguage( 'en' );
                $out = new OutputPage( $ctx );
                $rl = $out->getResourceLoader();
+               $rl->setMessageBlobStore( new NullMessageBlobStore() );
                $rl->register( array(
                        'test.foo' => new ResourceLoaderTestModule( array(
                                'script' => 'mw.test.foo( { a: true } );',
@@ -280,3 +281,26 @@ document.write("\u003Cscript src=\"http://127.0.0.1:8080/w/load.php?debug=false\
                $this->assertEquals( $expectedHtml, $actualHtml );
        }
 }
+
+/**
+ * MessageBlobStore that doesn't do anything
+ */
+class NullMessageBlobStore extends MessageBlobStore {
+       public function get ( ResourceLoader $resourceLoader, $modules, $lang ) {
+               return array();
+       }
+
+       public function insertMessageBlob ( $name, ResourceLoaderModule $module, $lang ) {
+               return false;
+       }
+
+       public function updateModule ( $name, ResourceLoaderModule $module, $lang ) {
+               return;
+       }
+
+       public function updateMessage ( $key ) {
+       }
+       public function clear() {
+       }
+}
+