X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fchanges%2FChangesList.php;h=03d1289f4b285da04313809d11c357c4515e4e63;hb=08e21a46f775f038abca424b7c15f9cad3510984;hp=cd43f82934ac500c75e7636144f3b7ffc620dc27;hpb=4f1390819a8fcd91c0c34449736fff4548032ad3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index cd43f82934..03d1289f4b 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -36,6 +36,9 @@ class ChangesList extends ContextSource { protected $rclistOpen; protected $rcMoveIndex; + /** @var MapCacheLRU */ + protected $watchingCache; + /** * Changeslist constructor * @@ -50,6 +53,7 @@ class ChangesList extends ContextSource { $this->skin = $obj; } $this->preCacheMessages(); + $this->watchingCache = new MapCacheLRU( 50 ); } /** @@ -110,9 +114,8 @@ class ChangesList extends ContextSource { * @return string */ public function recentChangesFlags( $flags, $nothing = ' ' ) { - global $wgRecentChangesFlags; $f = ''; - foreach ( array_keys( $wgRecentChangesFlags ) as $flag ) { + foreach ( array_keys( $this->getConfig()->get( 'RecentChangesFlags' ) ) as $flag ) { $f .= isset( $flags[$flag] ) && $flags[$flag] ? self::flag( $flag ) : $nothing; @@ -188,8 +191,6 @@ class ChangesList extends ContextSource { * @return string */ public static function showCharacterDifference( $old, $new, IContextSource $context = null ) { - global $wgRCChangedSizeThreshold, $wgMiserMode; - if ( !$context ) { $context = RequestContext::getMain(); } @@ -199,10 +200,11 @@ class ChangesList extends ContextSource { $szdiff = $new - $old; $lang = $context->getLanguage(); + $config = $context->getConfig(); $code = $lang->getCode(); static $fastCharDiff = array(); if ( !isset( $fastCharDiff[$code] ) ) { - $fastCharDiff[$code] = $wgMiserMode || $context->msg( 'rc-change-size' )->plain() === '$1'; + $fastCharDiff[$code] = $config->get( 'MiserMode' ) || $context->msg( 'rc-change-size' )->plain() === '$1'; } $formattedSize = $lang->formatNum( $szdiff ); @@ -211,7 +213,7 @@ class ChangesList extends ContextSource { $formattedSize = $context->msg( 'rc-change-size', $formattedSize )->text(); } - if ( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) { + if ( abs( $szdiff ) > abs( $config->get( 'RCChangedSizeThreshold' ) ) ) { $tag = 'strong'; } else { $tag = 'span'; @@ -438,8 +440,6 @@ class ChangesList extends ContextSource { } else { return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() ); } - - return ''; } /** @@ -462,14 +462,14 @@ class ChangesList extends ContextSource { * @return string */ protected function numberofWatchingusers( $count ) { - static $cache = array(); + $cache = $this->watchingCache; if ( $count > 0 ) { - if ( !isset( $cache[$count] ) ) { - $cache[$count] = $this->msg( 'number_of_watching_users_RCview' ) - ->numParams( $count )->escaped(); + if ( !$cache->has( $count ) ) { + $cache->set( $count, $this->msg( 'number_of_watching_users_RCview' ) + ->numParams( $count )->escaped() ); } - return $cache[$count]; + return $cache->get( $count ); } else { return ''; }