From: Ori Livneh Date: Thu, 11 Jun 2015 23:38:46 +0000 (-0700) Subject: Instrument edit failures X-Git-Tag: 1.31.0-rc.0~11108^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=1e7076c6e1663b153aed500a47af487f9cfbca66;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index e88baafe56..ee67d01d69 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -3464,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. @@ -3475,6 +3477,7 @@ HTML $parsedNote = $wgOut->parse( "
" . wfMessage( 'session_fail_preview_html' )->text() . "
", true, /* interface */true ); } + $stats->increment( 'edit.failures.session_loss' ); return $parsedNote; } @@ -3498,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; }