Mass conversion of $wgContLang to service
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index e6a15ce..5138655 100644 (file)
@@ -966,7 +966,7 @@ class DifferenceEngine extends ContextSource {
                        wfDeprecated( "\$wgExternalDiffEngine = '{$wgExternalDiffEngine}'", '1.27' );
                        $wgExternalDiffEngine = false;
                } elseif ( $wgExternalDiffEngine == 'wikidiff2' ) {
-                       // Same as above, but with no deprecation warnings
+                       wfDeprecated( "\$wgExternalDiffEngine = '{$wgExternalDiffEngine}'", '1.32' );
                        $wgExternalDiffEngine = false;
                } elseif ( !is_string( $wgExternalDiffEngine ) && $wgExternalDiffEngine !== false ) {
                        // And prevent people from shooting themselves in the foot...
@@ -992,8 +992,6 @@ class DifferenceEngine extends ContextSource {
         * @return bool|string
         */
        protected function textDiff( $otext, $ntext ) {
-               global $wgContLang;
-
                $otext = str_replace( "\r\n", "\n", $otext );
                $ntext = str_replace( "\r\n", "\n", $ntext );
 
@@ -1067,11 +1065,12 @@ class DifferenceEngine extends ContextSource {
                }
 
                # Native PHP diff
-               $ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) );
-               $nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
+               $contLang = MediaWikiServices::getInstance()->getContentLanguage();
+               $ota = explode( "\n", $contLang->segmentForDiff( $otext ) );
+               $nta = explode( "\n", $contLang->segmentForDiff( $ntext ) );
                $diffs = new Diff( $ota, $nta );
                $formatter = new TableDiffFormatter();
-               $difftext = $wgContLang->unsegmentForDiff( $formatter->format( $diffs ) );
+               $difftext = $contLang->unsegmentForDiff( $formatter->format( $diffs ) );
                $difftext .= $this->debug( 'native PHP' );
 
                return $difftext;