Merge "language: Use item 'fallbackSequence' instead of duplicating logic"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 4 Jun 2015 17:58:04 +0000 (17:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 4 Jun 2015 17:58:04 +0000 (17:58 +0000)
includes/Export.php
includes/Revision.php
includes/db/LoadMonitor.php
includes/diff/DifferenceEngine.php
includes/filerepo/file/LocalFile.php
includes/libs/HttpStatus.php
includes/page/WikiPage.php
includes/parser/ParserCache.php
includes/resourceloader/ResourceLoader.php
resources/Resources.php
resources/src/mediawiki/mediawiki.searchSuggest.js

index 4600feb..0d55d7d 100644 (file)
@@ -1191,7 +1191,7 @@ class Dump7ZipOutput extends DumpPipeOutput {
         * @return string
         */
        function setup7zCommand( $file ) {
-               $command = "7za a -bd -si " . wfEscapeShellArg( $file );
+               $command = "7za a -bd -si -mx=4 " . wfEscapeShellArg( $file );
                // Suppress annoying useless crap from p7zip
                // Unfortunately this could suppress real error messages too
                $command .= ' >' . wfGetNull() . ' 2>&1';
index 3ba6157..9bb4d16 100644 (file)
@@ -1284,8 +1284,14 @@ class Revision implements IDBAccessObject {
 
                if ( $wgCompressRevisions ) {
                        if ( function_exists( 'gzdeflate' ) ) {
-                               $text = gzdeflate( $text );
-                               $flags[] = 'gzip';
+                               $deflated = gzdeflate( $text );
+
+                               if ( $deflated === false ) {
+                                       wfLogWarning( __METHOD__ . ': gzdeflate() failed' );
+                               } else {
+                                       $text = $deflated;
+                                       $flags[] = 'gzip';
+                               }
                        } else {
                                wfDebug( __METHOD__ . " -- no zlib support, not compressing\n" );
                        }
@@ -1306,6 +1312,11 @@ class Revision implements IDBAccessObject {
                        # This can be done periodically via maintenance/compressOld.php, and
                        # as pages are saved if $wgCompressRevisions is set.
                        $text = gzinflate( $text );
+
+                       if ( $text === false ) {
+                               wfLogWarning( __METHOD__ . ': gzinflate() failed' );
+                               return false;
+                       }
                }
 
                if ( in_array( 'object', $flags ) ) {
index 3d853cb..8c4d0ed 100644 (file)
@@ -109,9 +109,9 @@ class LoadMonitorMySQL implements LoadMonitor {
 
                                return $times;
                        }
-                       wfIncrStats( 'lag_cache_miss_expired' );
+                       wfIncrStats( 'lag_cache.miss.expired' );
                } else {
-                       wfIncrStats( 'lag_cache_miss_absent' );
+                       wfIncrStats( 'lag_cache.miss.absent' );
                }
 
                # Cache key missing or expired
index 2c63dfb..07a0522 100644 (file)
@@ -714,7 +714,7 @@ class DifferenceEngine extends ContextSource {
                        if ( !$this->mRefreshCache ) {
                                $difftext = $wgMemc->get( $key );
                                if ( $difftext ) {
-                                       wfIncrStats( 'diff_cache_hit' );
+                                       wfIncrStats( 'diff_cache.hit' );
                                        $difftext = $this->localiseLineNumbers( $difftext );
                                        $difftext .= "\n<!-- diff cache key $key -->\n";
 
@@ -734,12 +734,12 @@ class DifferenceEngine extends ContextSource {
 
                // Save to cache for 7 days
                if ( !Hooks::run( 'AbortDiffCache', array( &$this ) ) ) {
-                       wfIncrStats( 'diff_uncacheable' );
+                       wfIncrStats( 'diff_cache.uncacheable' );
                } elseif ( $key !== false && $difftext !== false ) {
-                       wfIncrStats( 'diff_cache_miss' );
+                       wfIncrStats( 'diff_cache.miss' );
                        $wgMemc->set( $key, $difftext, 7 * 86400 );
                } else {
-                       wfIncrStats( 'diff_uncacheable' );
+                       wfIncrStats( 'diff_cache.uncacheable' );
                }
                // Replace line numbers with the text in the user's language
                if ( $difftext !== false ) {
index b763c8d..6abe00c 100644 (file)
@@ -269,9 +269,9 @@ class LocalFile extends File {
                }
 
                if ( $this->dataLoaded ) {
-                       wfIncrStats( 'image_cache_hit' );
+                       wfIncrStats( 'image_cache.hit' );
                } else {
-                       wfIncrStats( 'image_cache_miss' );
+                       wfIncrStats( 'image_cache.miss' );
                }
 
                return $this->dataLoaded;
index 809bfdf..442298a 100644 (file)
 class HttpStatus {
 
        /**
-        * Get the message associated with HTTP response code $code
+        * Get the message associated with an HTTP response status code
         *
-        * @param $code Integer: status code
-        * @return String or null: message or null if $code is not in the list of
-        *         messages
+        * @param int $code Status code
+        * @return string|null Message, or null if $code is not known
         */
        public static function getMessage( $code ) {
                static $statusMessage = array(
@@ -88,4 +87,25 @@ class HttpStatus {
                return isset( $statusMessage[$code] ) ? $statusMessage[$code] : null;
        }
 
+       /**
+        * Output an HTTP status code header
+        *
+        * @since 1.26
+        * @param int $code Status code
+        */
+       public static function header( $code ) {
+               static $version = null;
+               $message = self::getMessage( $code );
+               if ( $message === null ) {
+                       trigger_error( "Unknown HTTP status code $code", E_USER_WARNING );
+                       return false;
+               }
+
+               if ( $version === null ) {
+                       $version = isset( $_SERVER['SERVER_PROTOCOL'] ) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.0' ? '1.0' : '1.1';
+               }
+
+               header( "HTTP/$version $code $message" );
+       }
+
 }
index 1fd22cf..59e8731 100644 (file)
@@ -1111,7 +1111,7 @@ class WikiPage implements Page, IDBAccessObject {
                $useParserCache = $this->isParserCacheUsed( $parserOptions, $oldid );
                wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $parserOptions->getStubThreshold() ) {
-                       wfIncrStats( 'pcache_miss_stub' );
+                       wfIncrStats( 'pcache.miss.stub' );
                }
 
                if ( $useParserCache ) {
index 131b7b5..98d3f7f 100644 (file)
@@ -143,13 +143,13 @@ class ParserCache {
                $optionsKey = $this->mMemc->get( $this->getOptionsKey( $article ) );
                if ( $optionsKey != false ) {
                        if ( !$useOutdated && $optionsKey->expired( $article->getTouched() ) ) {
-                               wfIncrStats( "pcache_miss_expired" );
+                               wfIncrStats( "pcache.miss.expired" );
                                $cacheTime = $optionsKey->getCacheTime();
                                wfDebug( "Parser options key expired, touched " . $article->getTouched()
                                        . ", epoch $wgCacheEpoch, cached $cacheTime\n" );
                                return false;
                        } elseif ( $optionsKey->isDifferentRevision( $article->getLatest() ) ) {
-                               wfIncrStats( "pcache_miss_revid" );
+                               wfIncrStats( "pcache.miss.revid" );
                                $revId = $article->getLatest();
                                $cachedRevId = $optionsKey->getCacheRevisionId();
                                wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
@@ -195,14 +195,14 @@ class ParserCache {
 
                $parserOutputKey = $this->getKey( $article, $popts, $useOutdated );
                if ( $parserOutputKey === false ) {
-                       wfIncrStats( 'pcache_miss_absent' );
+                       wfIncrStats( 'pcache.miss.absent' );
                        return false;
                }
 
                $value = $this->mMemc->get( $parserOutputKey );
                if ( !$value ) {
                        wfDebug( "ParserOutput cache miss.\n" );
-                       wfIncrStats( "pcache_miss_absent" );
+                       wfIncrStats( "pcache.miss.absent" );
                        return false;
                }
 
@@ -214,19 +214,19 @@ class ParserCache {
                $value->setEditSectionTokens( $popts->getEditSection() );
 
                if ( !$useOutdated && $value->expired( $touched ) ) {
-                       wfIncrStats( "pcache_miss_expired" );
+                       wfIncrStats( "pcache.miss.expired" );
                        $cacheTime = $value->getCacheTime();
                        wfDebug( "ParserOutput key expired, touched $touched, "
                                . "epoch $wgCacheEpoch, cached $cacheTime\n" );
                        $value = false;
                } elseif ( $value->isDifferentRevision( $article->getLatest() ) ) {
-                       wfIncrStats( "pcache_miss_revid" );
+                       wfIncrStats( "pcache.miss.revid" );
                        $revId = $article->getLatest();
                        $cachedRevId = $value->getCacheRevisionId();
                        wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
                        $value = false;
                } else {
-                       wfIncrStats( "pcache_hit" );
+                       wfIncrStats( "pcache.hit" );
                }
 
                return $value;
index ccc7a17..5bc9dc3 100644 (file)
@@ -199,12 +199,12 @@ class ResourceLoader {
                        $cache = wfGetCache( wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING );
                        $cacheEntry = $cache->get( $key );
                        if ( is_string( $cacheEntry ) ) {
-                               wfIncrStats( "rl-$filter-cache-hits" );
+                               wfIncrStats( "resourceloader_cache.$filter.hit" );
                                return $cacheEntry;
                        }
                        $result = '';
                        try {
-                               wfIncrStats( "rl-$filter-cache-misses" );
+                               wfIncrStats( "resourceloader_cache.$filter.miss" );
                                $result = $this->applyFilter( $filter, $data );
                                if ( $options['cacheReport'] ) {
                                        $result .= "\n/* cache key: $key */";
index 9bc7b4e..644ff9c 100644 (file)
@@ -109,7 +109,6 @@ return array(
        // Used in the web installer. Test it after modifying this definition!
        'mediawiki.skinning.interface' => array(
                'position' => 'top',
-               // Display wiki logo on .mw-wiki-logo elements.
                'class' => 'ResourceLoaderSkinModule',
                'styles' => array(
                        'resources/src/mediawiki.skinning/elements.css' => array( 'media' => 'screen' ),
@@ -136,13 +135,6 @@ return array(
                ),
        ),
 
-       // Display wiki logo on .mw-wiki-logo elements.
-       // This is also part of 'mediawiki.skinning.interface' module; the skin shouldn't load them both.
-       'mediawiki.skinning.logo' => array(
-               'position' => 'top',
-               'class' => 'ResourceLoaderSkinModule',
-       ),
-
        /* jQuery */
 
        'jquery' => array(
index f981b90..1f3b123 100644 (file)
                        $region: $searchRegion
                } );
 
-               // If the form includes any fallback fulltext search buttons, remove them
-               $searchInput.closest( 'form' ).find( '.mw-fallbackSearchButton' ).remove();
+               $searchInput.closest( 'form' )
+                       // track the form submit event
+                       .on( 'submit', function () {
+                               var context = $searchInput.data( 'suggestionsContext' );
+                               mw.track( 'mediawiki.searchSuggest', {
+                                       action: 'submit-form',
+                                       numberOfResults: context.config.suggestions.length
+                               } );
+                       } )
+                       // If the form includes any fallback fulltext search buttons, remove them
+                       .find( '.mw-fallbackSearchButton' ).remove();
        } );
 
 }( mediaWiki, jQuery ) );