Merge "Add support for 'es-formal'"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 20 Feb 2018 19:05:24 +0000 (19:05 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 20 Feb 2018 19:05:24 +0000 (19:05 +0000)
docs/hooks.txt
includes/DevelopmentSettings.php
includes/cache/MessageCache.php
includes/libs/rdbms/loadmonitor/LoadMonitor.php
includes/media/Bitmap.php
includes/page/WikiPage.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/src/mediawiki/mediawiki.js

index 7084b51..4e8474b 100644 (file)
@@ -2333,6 +2333,7 @@ $wikiPage: the WikiPage edited
 $rev: the new revision
 $baseID: the revision ID this was based off, if any
 $user: the editing user
+&$tags: tags to apply to the edit and recent change
 
 'OldChangesListRecentChangesLine': Customize entire recent changes line, or
 return false to omit the line from RecentChanges and Watchlist special pages.
index a74353a..96ed56b 100644 (file)
@@ -38,11 +38,6 @@ $wgShowExceptionDetails = true;
 $wgShowSQLErrors = true;
 $wgDebugRawPage = true; // T49960
 
-// Enable verbose logging
-$wgDebugComments = true;
-$wgDebugDumpSql = true;
-$wgDebugTimestamps = true;
-
 // Enable log files
 $logDir = getenv( 'MW_LOG_DIR' );
 if ( $logDir ) {
index d5ff6cb..2d85d69 100644 (file)
@@ -613,7 +613,7 @@ class MessageCache {
                                // load() calls do try to refresh the cache with replica DB data
                                $this->mCache[$code]['LATEST'] = time();
                                // Pre-emptively update the local datacenter cache so things like edit filter and
-                               // blacklist changes are reflect immediately, as these often use MediaWiki: pages.
+                               // blacklist changes are reflected immediately; these often use MediaWiki: pages.
                                // The datacenter handling replace() calls should be the same one handling edits
                                // as they require HTTP POST.
                                $this->saveToCaches( $this->mCache[$code], 'all', $code );
@@ -906,7 +906,7 @@ class MessageCache {
                if ( $useDB ) {
                        $uckey = $wgContLang->ucfirst( $lckey );
 
-                       if ( !isset( $alreadyTried[ $langcode ] ) ) {
+                       if ( !isset( $alreadyTried[$langcode] ) ) {
                                $message = $this->getMsgFromNamespace(
                                        $this->getMessagePageName( $langcode, $uckey ),
                                        $langcode
@@ -915,7 +915,7 @@ class MessageCache {
                                if ( $message !== false ) {
                                        return $message;
                                }
-                               $alreadyTried[ $langcode ] = true;
+                               $alreadyTried[$langcode] = true;
                        }
                } else {
                        $uckey = null;
@@ -932,7 +932,7 @@ class MessageCache {
                        $fallbackChain = Language::getFallbacksFor( $langcode );
 
                        foreach ( $fallbackChain as $code ) {
-                               if ( isset( $alreadyTried[ $code ] ) ) {
+                               if ( isset( $alreadyTried[$code] ) ) {
                                        continue;
                                }
 
@@ -942,7 +942,7 @@ class MessageCache {
                                if ( $message !== false ) {
                                        return $message;
                                }
-                               $alreadyTried[ $code ] = true;
+                               $alreadyTried[$code] = true;
                        }
                }
 
@@ -985,13 +985,12 @@ class MessageCache {
                if ( isset( $this->mCache[$code][$title] ) ) {
                        $entry = $this->mCache[$code][$title];
                        if ( substr( $entry, 0, 1 ) === ' ' ) {
-                               // The message exists, so make sure a string is returned.
+                               // The message exists and is not '!TOO BIG'
                                return (string)substr( $entry, 1 );
                        } elseif ( $entry === '!NONEXISTENT' ) {
                                return false;
-                       } elseif ( $entry === '!TOO BIG' ) {
-                               // Fall through and try invididual message cache below
                        }
+                       // Fall through and try invididual message cache below
                } else {
                        // XXX: This is not cached in process cache, should it?
                        $message = false;
@@ -1077,11 +1076,11 @@ class MessageCache {
        /**
         * @param string $message
         * @param bool $interface
-        * @param string $language Language code
+        * @param Language $language
         * @param Title $title
         * @return string
         */
-       function transform( $message, $interface = false, $language = null, $title = null ) {
+       public function transform( $message, $interface = false, $language = null, $title = null ) {
                // Avoid creating parser if nothing to transform
                if ( strpos( $message, '{{' ) === false ) {
                        return $message;
@@ -1110,7 +1109,7 @@ class MessageCache {
        /**
         * @return Parser
         */
-       function getParser() {
+       public function getParser() {
                global $wgParser, $wgParserConf;
 
                if ( !$this->mParser && isset( $wgParser ) ) {
@@ -1174,11 +1173,11 @@ class MessageCache {
                return $res;
        }
 
-       function disable() {
+       public function disable() {
                $this->mDisable = true;
        }
 
-       function enable() {
+       public function enable() {
                $this->mDisable = false;
        }
 
index 74c7765..50c878d 100644 (file)
@@ -81,13 +81,13 @@ class LoadMonitor implements ILoadMonitor {
                $this->replLogger = $logger;
        }
 
-       public function scaleLoads( array &$weightByServer, $domain ) {
+       final public function scaleLoads( array &$weightByServer, $domain ) {
                $serverIndexes = array_keys( $weightByServer );
                $states = $this->getServerStates( $serverIndexes, $domain );
-               $coefficientsByServer = $states['weightScales'];
+               $newScalesByServer = $states['weightScales'];
                foreach ( $weightByServer as $i => $weight ) {
-                       if ( isset( $coefficientsByServer[$i] ) ) {
-                               $weightByServer[$i] = $weight * $coefficientsByServer[$i];
+                       if ( isset( $newScalesByServer[$i] ) ) {
+                               $weightByServer[$i] = $weight * $newScalesByServer[$i];
                        } else { // server recently added to config?
                                $host = $this->parent->getServerName( $i );
                                $this->replLogger->error( __METHOD__ . ": host $host not in cache" );
@@ -95,10 +95,8 @@ class LoadMonitor implements ILoadMonitor {
                }
        }
 
-       public function getLagTimes( array $serverIndexes, $domain ) {
-               $states = $this->getServerStates( $serverIndexes, $domain );
-
-               return $states['lagTimes'];
+       final public function getLagTimes( array $serverIndexes, $domain ) {
+               return $this->getServerStates( $serverIndexes, $domain )['lagTimes'];
        }
 
        protected function getServerStates( array $serverIndexes, $domain ) {
index 712906e..b88a34d 100644 (file)
@@ -440,6 +440,14 @@ class BitmapHandler extends TransformationalImageHandler {
                        return $this->getMediaTransformError( $params, $errMsg );
                }
 
+               if ( filesize( $params['srcPath'] ) === 0 ) {
+                       $err = "Image file size seems to be zero.";
+                       wfDebug( "$err\n" );
+                       $errMsg = wfMessage( 'thumbnail_image-size-zero', $params['srcPath'] )->text();
+
+                       return $this->getMediaTransformError( $params, $errMsg );
+               }
+
                $src_image = call_user_func( $loader, $params['srcPath'] );
 
                $rotation = function_exists( 'imagerotate' ) && !isset( $params['disableRotation'] ) ?
index a47b001..544d23d 100644 (file)
@@ -1771,8 +1771,9 @@ class WikiPage implements Page, IDBAccessObject {
                                throw new MWException( "Failed to update page row to use new revision." );
                        }
 
+                       $tags = $meta['tags'];
                        Hooks::run( 'NewRevisionFromEditComplete',
-                               [ $this, $revision, $meta['baseRevId'], $user ] );
+                               [ $this, $revision, $meta['baseRevId'], $user, &$tags ] );
 
                        // Update recentchanges
                        if ( !( $flags & EDIT_SUPPRESS_RC ) ) {
@@ -1794,7 +1795,7 @@ class WikiPage implements Page, IDBAccessObject {
                                        $newsize,
                                        $revisionId,
                                        $patrolled,
-                                       $meta['tags']
+                                       $tags
                                );
                        }
 
index b710762..bcf0ec5 100644 (file)
        "thumbnail_dest_directory": "Unable to create destination directory",
        "thumbnail_image-type": "Image type not supported",
        "thumbnail_gd-library": "Incomplete GD library configuration: Missing function $1",
+       "thumbnail_image-size-zero": "Image file size seems to be zero.",
        "thumbnail_image-missing": "File seems to be missing: $1",
        "thumbnail_image-failure-limit": "There have been too many recent failed attempts ($1 or more) to render this thumbnail. Please try again later.",
        "import": "Import pages",
index 6a071ed..852d3eb 100644 (file)
        "thumbnail_image-type": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}",
        "thumbnail_gd-library": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}.\n*$1 is a function name of the GD library",
        "thumbnail_image-missing": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}.\n*$1 is the path incl. filename of the missing image",
+       "thumbnail_image-size-zero": "This is the parameter 1 of the message {{msg-mw|thumbnail error}}.\n*$1 is the path incl. filename of the image with zero size",
        "thumbnail_image-failure-limit": "Used as <code>$1</code> in {{msg-mw|Thumbnail error}}.\n\nParameters:\n* $1 - the maximum allowed number of failed attempts",
        "import": "The title of the special page [[Special:Import]];",
        "import-summary": "{{doc-specialpagesummary|import}}",
index e9efc16..a2e071e 100644 (file)
                                 *         OO.compare( [ 1 ], [ 1 ] );
                                 *     } );
                                 *
+                                * Example of inline dependency obtained via `require()`:
+                                *
+                                *     mw.loader.using( [ 'mediawiki.util' ], function ( require ) {
+                                *         var util = require( 'mediawiki.util' );
+                                *     } );
+                                *
                                 * Since MediaWiki 1.23 this also returns a promise.
                                 *
                                 * Since MediaWiki 1.28 the promise is resolved with a `require` function.
                                /**
                                 * Get the exported value of a module.
                                 *
-                                * Modules may provide this via their local `module.exports`.
+                                * This static method is publicly exposed for debugging purposes
+                                * only and must not be used in production code. In production code,
+                                * please use the dynamically provided `require()` function instead.
                                 *
-                                * @protected
+                                * In case of lazy-loaded modules via mw.loader#using(), the returned
+                                * Promise provides the function, see #using() for examples.
+                                *
+                                * @private
                                 * @since 1.27
                                 * @param {string} moduleName Module name
                                 * @return {Mixed} Exported value