X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FFeedUtils.php;h=071a3db98fa4f29cf49f6a64766b5d12bf2089d8;hb=13bb844fdfff794525e2cb202176ddee3a23ef06;hp=57ba4b3e083bc989d04e57f0b0bc592927b5ddf3;hpb=230f2b456b0dd53cb9056edcf765aab49197906a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 57ba4b3e08..96a88d3d98 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -30,18 +30,20 @@ class FeedUtils { /** * Check whether feed's cache should be cleared; for changes feeds - * If the feed should be purged; $timekey and $key will be removed from - * $messageMemc + * If the feed should be purged; $timekey and $key will be removed from cache * * @param string $timekey Cache key of the timestamp of the last item * @param string $key Cache key of feed's content */ public static function checkPurge( $timekey, $key ) { - global $wgRequest, $wgUser, $messageMemc; + global $wgRequest, $wgUser; + $purge = $wgRequest->getVal( 'action' ) === 'purge'; + // Allow users with 'purge' right to clear feed caches if ( $purge && $wgUser->isAllowed( 'purge' ) ) { - $messageMemc->delete( $timekey ); - $messageMemc->delete( $key ); + $cache = ObjectCache::getMainWANInstance(); + $cache->delete( $timekey, 1 ); + $cache->delete( $key, 1 ); } } @@ -110,9 +112,9 @@ class FeedUtils { // log entries $completeText = '

' . implode( ' ', array_filter( - array( + [ $actiontext, - Linker::formatComment( $comment ) ) ) ) . "

\n"; + Linker::formatComment( $comment ) ] ) ) . "

\n"; // NOTE: Check permissions for anonymous users, not current user. // No "privileged" version should end up in the cache. @@ -127,13 +129,6 @@ class FeedUtils { } if ( $oldid ) { - - # $diffText = $de->getDiff( wfMessage( 'revisionasof', - # $wgLang->timeanddate( $timestamp ), - # $wgLang->date( $timestamp ), - # $wgLang->time( $timestamp ) )->text(), - # wfMessage( 'currentrev' )->text() ); - $diffText = ''; // Don't bother generating the diff if we won't be able to show it if ( $wgFeedDiffCutoff > 0 ) { @@ -193,8 +188,7 @@ class FeedUtils { } if ( $html === null ) { - - // Omit large new page diffs, bug 29110 + // Omit large new page diffs, T31110 // Also use diff link for non-textual content $diffText = self::getDiffLink( $title, $newid ); } else { @@ -217,13 +211,13 @@ class FeedUtils { * @return string */ protected static function getDiffLink( Title $title, $newid, $oldid = null ) { - $queryParameters = array( 'diff' => $newid ); + $queryParameters = [ 'diff' => $newid ]; if ( $oldid != null ) { $queryParameters['oldid'] = $oldid; } $diffUrl = $title->getFullURL( $queryParameters ); - $diffLink = Html::element( 'a', array( 'href' => $diffUrl ), + $diffLink = Html::element( 'a', [ 'href' => $diffUrl ], wfMessage( 'showdiff' )->inContentLanguage()->text() ); return $diffLink; @@ -238,7 +232,7 @@ class FeedUtils { * @return string Modified HTML */ public static function applyDiffStyle( $text ) { - $styles = array( + $styles = [ 'diff' => 'background-color: white; color:black;', 'diff-otitle' => 'background-color: white; color:black; text-align: center;', 'diff-ntitle' => 'background-color: white; color:black; text-align: center;', @@ -252,7 +246,7 @@ class FeedUtils { . 'border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; ' . 'border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;', 'diffchange' => 'font-weight: bold; text-decoration: none;', - ); + ]; foreach ( $styles as $class => $style ) { $text = preg_replace( "/(<[^>]+)class=(['\"])$class\\2([^>]*>)/",