X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FFeedUtils.php;h=d7dbd2292eb96b4e552181c0d1174069e5b32e26;hb=41d1fa1c3aa9d6e9e0e5f0c5455b9092833e9012;hp=a01d64208c528d75bf41d65b546885aa88873c21;hpb=4e90d55fdc9d31d93e24cf05687eb7d180806f44;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index a01d64208c..d7dbd2292e 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -30,18 +30,19 @@ 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'; if ( $purge && $wgUser->isAllowed( 'purge' ) ) { - $messageMemc->delete( $timekey ); - $messageMemc->delete( $key ); + $cache = ObjectCache::getMainWANInstance(); + $cache->delete( $timekey, 1 ); + $cache->delete( $key, 1 ); } } @@ -110,9 +111,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. @@ -128,11 +129,11 @@ class FeedUtils { if ( $oldid ) { - #$diffText = $de->getDiff( wfMessage( 'revisionasof', - # $wgLang->timeanddate( $timestamp ), - # $wgLang->date( $timestamp ), - # $wgLang->time( $timestamp ) )->text(), - # wfMessage( 'currentrev' )->text() ); + # $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 @@ -185,10 +186,10 @@ class FeedUtils { $html = nl2br( htmlspecialchars( $text ) ); } } else { - //XXX: we could get an HTML representation of the content via getParserOutput, but that may + // XXX: we could get an HTML representation of the content via getParserOutput, but that may // contain JS magic and generally may not be suitable for inclusion in a feed. // Perhaps Content should have a getDescriptiveHtml method and/or a getSourceText method. - //Compare also ApiFeedContributions::feedItemDesc + // Compare also ApiFeedContributions::feedItemDesc $html = null; } @@ -217,13 +218,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 +239,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 +253,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([^>]*>)/",