Merge "resourceloader: Add ResourceLoaderModule::shouldEmbedModule and use it"
[lhc/web/wiklou.git] / includes / EditPage.php
index 6be8771..973327b 100644 (file)
@@ -422,8 +422,6 @@ class EditPage {
         * @param Article $article
         */
        public function __construct( Article $article ) {
-               global $wgOOUIEditPage;
-
                $this->mArticle = $article;
                $this->page = $article->getPage(); // model object
                $this->mTitle = $article->getTitle();
@@ -434,7 +432,7 @@ class EditPage {
                $handler = ContentHandler::getForModelID( $this->contentModel );
                $this->contentFormat = $handler->getDefaultFormat();
 
-               $this->oouiEnabled = $wgOOUIEditPage;
+               $this->oouiEnabled = $this->context->getConfig()->get( 'OOUIEditPage' );
        }
 
        /**
@@ -1493,6 +1491,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 +1524,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 );