Merge "Drop Linker::formatSize, deprecated in 1.28 and unused"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 9 Feb 2019 07:33:23 +0000 (07:33 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 9 Feb 2019 07:33:23 +0000 (07:33 +0000)
includes/MediaWiki.php
resources/src/startup/mediawiki.js

index f5a954d..43512e1 100644 (file)
@@ -569,8 +569,11 @@ class MediaWiki {
        }
 
        /**
-        * This function commits all DB changes as needed before
-        * the user can receive a response (in case commit fails)
+        * This function commits all DB and session changes as needed *before* the
+        * client can receive a response (in case DB commit fails) and thus also before
+        * the response can trigger a subsequent related request by the client
+        *
+        * If there is a significant amount of content to flush, it can be done in $postCommitWork
         *
         * @param IContextSource $context
         * @param callable|null $postCommitWork [default: null]
@@ -598,6 +601,8 @@ class MediaWiki {
                // Run updates that need to block the user or affect output (this is the last chance)
                DeferredUpdates::doUpdates( 'enqueue', DeferredUpdates::PRESEND );
                wfDebug( __METHOD__ . ': pre-send deferred updates completed' );
+               // T214471: persist the session to avoid race conditions on subsequent requests
+               $request->getSession()->save();
 
                // Should the client return, their request should observe the new ChronologyProtector
                // DB positions. This request might be on a foreign wiki domain, so synchronously update
index 8b2aa29..44e48e5 100644 (file)
                 * @param {string} key Name of property to create in `obj`
                 * @param {Mixed} val The value this property should return when accessed
                 * @param {string} [msg] Optional text to include in the deprecation message
-                * @param {string} [logName=key] Optional custom name for the feature.
-                *  This is used instead of `key` in the message and `mw.deprecate` tracking.
+                * @param {string} [logName] Name for the feature for logging and tracking
+                *  purposes. Except for properties of the window object, tracking is only
+                *  enabled if logName is set.
                 */
                log.deprecate = function ( obj, key, val, msg, logName ) {
                        var stacks;
                        function maybeLog() {
-                               var name,
+                               var name = logName || key,
                                        trace = new Error().stack;
                                if ( !stacks ) {
                                        stacks = new StringSet();
                                }
                                if ( !stacks.has( trace ) ) {
                                        stacks.add( trace );
-                                       name = logName || key;
-                                       mw.track( 'mw.deprecate', name );
+                                       if ( logName || obj === window ) {
+                                               mw.track( 'mw.deprecate', name );
+                                       }
                                        mw.log.warn(
                                                'Use of "' + name + '" is deprecated.' + ( msg ? ( ' ' + msg ) : '' )
                                        );