Removed redundant anchors from headings as suggested by Aryeh Gregor on wikitech...
[lhc/web/wiklou.git] / includes / FeedUtils.php
index aa784c0..005069b 100644 (file)
@@ -13,7 +13,7 @@ class FeedUtils {
        }
 
        public static function checkFeedOutput( $type ) {
-               global $wgFeed, $wgOut, $wgFeedClasses;
+               global $wgFeed, $wgFeedClasses;
 
                if ( !$wgFeed ) {
                        global $wgOut;
@@ -75,17 +75,24 @@ class FeedUtils {
                        if( $oldid ) {
                                wfProfileIn( __FUNCTION__."-dodiff" );
 
-                               $de = new DifferenceEngine( $title, $oldid, $newid );
                                #$diffText = $de->getDiff( wfMsg( 'revisionasof',
-                               #       $wgContLang->timeanddate( $timestamp ) ),
+                               #       $wgContLang->timeanddate( $timestamp ),
+                               #       $wgContLang->date( $timestamp ),
+                               #       $wgContLang->time( $timestamp ) ),
                                #       wfMsg( 'currentrev' ) );
-                               $diffText = $de->getDiff(
-                                       wfMsg( 'previousrevision' ), // hack
-                                       wfMsg( 'revisionasof',
-                                               $wgContLang->timeanddate( $timestamp ) ) );
-
+                               
+                               // Don't bother generating the diff if we won't be able to show it
+                               if ( $wgFeedDiffCutoff > 0 ) {
+                                       $de = new DifferenceEngine( $title, $oldid, $newid );
+                                       $diffText = $de->getDiff(
+                                               wfMsg( 'previousrevision' ), // hack
+                                               wfMsg( 'revisionasof',
+                                                       $wgContLang->timeanddate( $timestamp ),
+                                                       $wgContLang->date( $timestamp ),
+                                                       $wgContLang->time( $timestamp ) ) );
+                               }
 
-                               if ( strlen( $diffText ) > $wgFeedDiffCutoff ) {
+                               if ( ( strlen( $diffText ) > $wgFeedDiffCutoff ) || ( $wgFeedDiffCutoff <= 0 ) ) {
                                        // Omit large diffs
                                        $diffLink = $title->escapeFullUrl(
                                                'diff=' . $newid .
@@ -149,4 +156,4 @@ class FeedUtils {
                return $text;
        }
 
-}
\ No newline at end of file
+}