Ori.livneh has submitted this change and it was merged.

Change subject: Instrument edit failures
......................................................................


Instrument edit failures

Users on enwiki's VPT are reporting a spike in the frequency of rejected edits
due to loss of session data. It is difficult to corroborate these reports when
we don't have any instrumentation for them in the code, and thus no visibility
into how frequently they are occurring in the wild.

Bug: T102199
Change-Id: I0c99f292002209cf2bf4376f97b8c70a6b1ec021
---
M includes/EditPage.php
1 file changed, 8 insertions(+), 0 deletions(-)

Approvals:
  Ori.livneh: Verified; Looks good to me, approved



diff --git a/includes/EditPage.php b/includes/EditPage.php
index e88baaf..ee67d01 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -3464,6 +3464,8 @@
                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.
@@ -3475,6 +3477,7 @@
                                $parsedNote = $wgOut->parse( "<div 
class='previewnote'>" .
                                        wfMessage( 'session_fail_preview_html' 
)->text() . "</div>", true, /* interface */true );
                        }
+                       $stats->increment( 'edit.failures.session_loss' );
                        return $parsedNote;
                }
 
@@ -3498,11 +3501,16 @@
                        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;
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/217752
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0c99f292002209cf2bf4376f97b8c70a6b1ec021
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.26wmf9
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to