Fix \n handling for HTMLUsersMultiselectField
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 559a5ec..b0ab244 100644 (file)
@@ -20,6 +20,7 @@
  * @file
  * @ingroup DifferenceEngine
  */
+use MediaWiki\MediaWikiServices;
 
 /** @deprecated use class constant instead */
 define( 'MW_DIFF_VERSION', '1.11a' );
@@ -82,7 +83,7 @@ class DifferenceEngine extends ContextSource {
        /**
         * Set this to true to add debug info to the HTML output.
         * Warning: this may cause RSS readers to spuriously mark articles as "new"
-        * (bug 20601)
+        * (T22601)
         */
        public $enableDebugComment = false;
 
@@ -762,8 +763,11 @@ class DifferenceEngine extends ContextSource {
 
                $difftext = $this->generateContentDiffBody( $this->mOldContent, $this->mNewContent );
 
+               // Avoid PHP 7.1 warning from passing $this by reference
+               $diffEngine = $this;
+
                // Save to cache for 7 days
-               if ( !Hooks::run( 'AbortDiffCache', [ &$this ] ) ) {
+               if ( !Hooks::run( 'AbortDiffCache', [ &$diffEngine ] ) ) {
                        wfIncrStats( 'diff_cache.uncacheable' );
                } elseif ( $key !== false && $difftext !== false ) {
                        wfIncrStats( 'diff_cache.miss' );
@@ -849,7 +853,7 @@ class DifferenceEngine extends ContextSource {
                        $result = $this->textDiff( $otext, $ntext );
 
                        $time = intval( ( microtime( true ) - $time ) * 1000 );
-                       $this->getStats()->timing( 'diff_time', $time );
+                       MediaWikiServices::getInstance()->getStatsdDataFactory()->timing( 'diff_time', $time );
                        // Log requests slower than 99th percentile
                        if ( $time > 100 && $this->mOldPage && $this->mNewPage ) {
                                wfDebugLog( 'diff',
@@ -982,7 +986,7 @@ class DifferenceEngine extends ContextSource {
        public function localiseLineNumbers( $text ) {
                return preg_replace_callback(
                        '/<!--LINE (\d+)-->/',
-                       [ &$this, 'localiseLineNumbersCb' ],
+                       [ $this, 'localiseLineNumbersCb' ],
                        $text
                );
        }