HTTPS-ify links to Wikimedia's sites in MW core source
[lhc/web/wiklou.git] / includes / EditPage.php
index 1679c3b..ee67d01 100644 (file)
@@ -1958,11 +1958,13 @@ class EditPage {
 
                if ( $this->changeTags && isset( $doEditStatus->value['revision'] ) ) {
                        // If a revision was created, apply any change tags that were requested
-                       ChangeTags::addTags(
-                               $this->changeTags,
-                               isset( $doEditStatus->value['rc'] ) ? $doEditStatus->value['rc']->mAttribs['rc_id'] : null,
-                               $doEditStatus->value['revision']->getId()
-                       );
+                       $addTags = $this->changeTags;
+                       $revId = $doEditStatus->value['revision']->getId();
+                       // Defer this both for performance and so that addTags() sees the rc_id
+                       // since the recentchange entry addition is deferred first (bug T100248)
+                       DeferredUpdates::addCallableUpdate( function() use ( $addTags, $revId ) {
+                               ChangeTags::addTags( $addTags, null, $revId );
+                       } );
                }
 
                return $status;
@@ -3462,6 +3464,8 @@ HTML
                global $wgOut, $wgUser, $wgRawHtml, $wgLang;
                global $wgAllowUserCss, $wgAllowUserJs;
 
+               $stats = $wgOut->getContext()->getStats();
+
                if ( $wgRawHtml && !$this->mTokenOk ) {
                        // Could be an offsite preview attempt. This is very unsafe if
                        // HTML is enabled, as it could be an attack.
@@ -3473,6 +3477,7 @@ HTML
                                $parsedNote = $wgOut->parse( "<div class='previewnote'>" .
                                        wfMessage( 'session_fail_preview_html' )->text() . "</div>", true, /* interface */true );
                        }
+                       $stats->increment( 'edit.failures.session_loss' );
                        return $parsedNote;
                }
 
@@ -3496,11 +3501,16 @@ HTML
                        if ( $this->mTriedSave && !$this->mTokenOk ) {
                                if ( $this->mTokenOkExceptSuffix ) {
                                        $note = wfMessage( 'token_suffix_mismatch' )->plain();
+                                       $stats->increment( 'edit.failures.bad_token' );
                                } else {
                                        $note = wfMessage( 'session_fail_preview' )->plain();
+                                       $stats->increment( 'edit.failures.session_loss' );
                                }
                        } elseif ( $this->incompleteForm ) {
                                $note = wfMessage( 'edit_form_incomplete' )->plain();
+                               if ( $this->mTriedSave ) {
+                                       $stats->increment( 'edit.failures.incomplete_form' );
+                               }
                        } else {
                                $note = wfMessage( 'previewnote' )->plain() . ' ' . $continueEditing;
                        }
@@ -3749,7 +3759,7 @@ HTML
                }
 
                $script .= '});';
-               $wgOut->addScript( Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( $script ) ) );
+               $wgOut->addScript( ResourceLoader::makeInlineScript( $script ) );
 
                $toolbar = '<div id="toolbar"></div>';