Merge "Adding a bunch of hooks from wikiHow into DifferenceEngine, 2nd try"
[lhc/web/wiklou.git] / includes / diff / DifferenceEngine.php
index 84f2aca..4a6ac8e 100644 (file)
  * @ingroup DifferenceEngine
  */
 
-/**
- * Constant to indicate diff cache compatibility.
- * Bump this when changing the diff formatting in a way that
- * fixes important bugs or such to force cached diff views to
- * clear.
- */
+// Deprecated, use class constant instead
 define( 'MW_DIFF_VERSION', '1.11a' );
 
 /**
@@ -34,6 +29,13 @@ define( 'MW_DIFF_VERSION', '1.11a' );
  * @ingroup DifferenceEngine
  */
 class DifferenceEngine extends ContextSource {
+       /**
+        * Constant to indicate diff cache compatibility.
+        * Bump this when changing the diff formatting in a way that
+        * fixes important bugs or such to force cached diff views to
+        * clear.
+        */
+       const DIFF_VERSION = MW_DIFF_VERSION;
 
        /** @var int */
        public $mOldid;
@@ -553,6 +555,7 @@ class DifferenceEngine extends ContextSource {
                        // Build the link
                        if ( $rcid ) {
                                $this->getOutput()->preventClickjacking();
+                               $this->getOutput()->addModuleStyles( 'mediawiki.page.patrol' );
                                if ( $wgEnableAPI && $wgEnableWriteAPI
                                        && $user->isAllowed( 'writeapi' )
                                ) {
@@ -809,7 +812,7 @@ class DifferenceEngine extends ContextSource {
                        throw new MWException( 'mOldid and mNewid must be set to get diff cache key.' );
                }
 
-               return wfMemcKey( 'diff', 'version', MW_DIFF_VERSION,
+               return wfMemcKey( 'diff', 'version', self::DIFF_VERSION,
                        'oldid', $this->mOldid, 'newid', $this->mNewid );
        }
 
@@ -849,21 +852,6 @@ class DifferenceEngine extends ContextSource {
                return $this->generateTextDiffBody( $otext, $ntext );
        }
 
-       /**
-        * Generate a diff, no caching
-        *
-        * @param string $otext Old text, must be already segmented
-        * @param string $ntext New text, must be already segmented
-        *
-        * @return bool|string
-        * @deprecated since 1.21, use generateContentDiffBody() instead!
-        */
-       public function generateDiffBody( $otext, $ntext ) {
-               ContentHandler::deprecated( __METHOD__, "1.21" );
-
-               return $this->generateTextDiffBody( $otext, $ntext );
-       }
-
        /**
         * Generate a diff, no caching
         *
@@ -926,7 +914,7 @@ class DifferenceEngine extends ContextSource {
                } elseif ( $wgExternalDiffEngine == 'wikidiff2' ) {
                        // Same as above, but with no deprecation warnings
                        $wgExternalDiffEngine = false;
-               } elseif ( !is_string( $wgExternalDiffEngine ) ) {
+               } elseif ( !is_string( $wgExternalDiffEngine ) && $wgExternalDiffEngine !== false ) {
                        // And prevent people from shooting themselves in the foot...
                        wfWarn( '$wgExternalDiffEngine is set to a non-string value, forcing it to false' );
                        $wgExternalDiffEngine = false;