Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / editpage / TextConflictHelper.php
index b1eaa4b..2471b52 100644 (file)
@@ -140,6 +140,15 @@ class TextConflictHelper {
         */
        public function incrementResolvedStats() {
                $this->stats->increment( 'edit.failures.conflict.resolved' );
+               // Only include 'standard' namespaces to avoid creating unknown numbers of statsd metrics
+               if (
+                       $this->title->getNamespace() >= NS_MAIN &&
+                       $this->title->getNamespace() <= NS_CATEGORY_TALK
+               ) {
+                       $this->stats->increment(
+                               'edit.failures.conflict.resolved.byNamespaceId.' . $this->title->getNamespace()
+                       );
+               }
        }
 
        /**
@@ -153,6 +162,32 @@ class TextConflictHelper {
                );
        }
 
+       /**
+        * HTML to build the textbox1 on edit conflicts
+        *
+        * @param array $customAttribs
+        */
+       public function getEditConflictMainTextBox( array $customAttribs = [] ) {
+               $builder = new TextboxBuilder();
+               $classes = $builder->getTextboxProtectionCSSClasses( $this->title );
+
+               $attribs = [ 'tabindex' => 1 ];
+               $attribs += $customAttribs;
+
+               $attribs = $builder->mergeClassesIntoAttributes( $classes, $attribs );
+
+               $attribs = $builder->buildTextboxAttribs(
+                       'wpTextbox1',
+                       $attribs,
+                       $this->out->getUser(),
+                       $this->title
+               );
+
+               $this->out->addHTML(
+                       Html::textarea( 'wpTextbox1', $builder->addNewLineAtEnd( $this->storedversion ), $attribs )
+               );
+       }
+
        /**
         * Content to go in the edit form before textbox1
         *