Add tracking for resolved conflicts
authorWMDE-Fisch <christoph.jauera@wikimedia.de>
Wed, 28 Jun 2017 07:15:46 +0000 (09:15 +0200)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Wed, 28 Jun 2017 13:51:58 +0000 (13:51 +0000)
Bug: T167863
Change-Id: I48bbfc7216d1f726dbcec3ae337466bbf8b2a486

includes/EditPage.php

index 6be8771..814c248 100644 (file)
@@ -1493,6 +1493,20 @@ class EditPage {
                return $status;
        }
 
+       /**
+        * Log when a page was successfully saved after the edit conflict view
+        */
+       private function incrementResolvedConflicts() {
+               global $wgRequest;
+
+               if ( $wgRequest->getText( 'mode' ) !== 'conflict' ) {
+                       return;
+               }
+
+               $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
+               $stats->increment( 'edit.failures.conflict.resolved' );
+       }
+
        /**
         * Handle status, such as after attempt save
         *
@@ -1512,6 +1526,8 @@ class EditPage {
                if ( $status->value == self::AS_SUCCESS_UPDATE
                        || $status->value == self::AS_SUCCESS_NEW_ARTICLE
                ) {
+                       $this->incrementResolvedConflicts();
+
                        $this->didSave = true;
                        if ( !$resultDetails['nullEdit'] ) {
                                $this->setPostEditCookie( $status->value );