X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FChangesList.php;h=3efa66f9c5aa55041c3275f64f990551fc765bc8;hb=246d7c081a7dd9b6b6c65bfd0377f62967dd8765;hp=ac7ee9c89c13e63fd9a4cd1879499b6baf4cdc29;hpb=e53d3fe26e3dd47979b48337ad1393b3220b0a65;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ChangesList.php b/includes/ChangesList.php index ac7ee9c89c..3efa66f9c5 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -108,11 +108,18 @@ class ChangesList { public static function showCharacterDifference( $old, $new ) { global $wgRCChangedSizeThreshold, $wgLang, $wgMiserMode; $szdiff = $new - $old; + + $code = $wgLang->getCode(); + static $fastCharDiff = array(); + if ( !isset($fastCharDiff[$code]) ) { + $fastCharDiff[$code] = $wgMiserMode || wfMsgNoTrans( 'rc-change-size' ) === '$1'; + } - $formatedSize = ( $wgMiserMode? - $wgLang->formatNum($szdiff) : // avoid expensive calculations - wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape' ), $wgLang->formatNum( $szdiff ) ) - ); + $formatedSize = $wgLang->formatNum($szdiff); + + if ( !$fastCharDiff[$code] ) { + $formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape' ), $formatedSize ); + } if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) { $tag = 'strong'; @@ -368,7 +375,7 @@ class OldChangesList extends ChangesList { * Format a line using the old system (aka without any javascript). */ public function recentChangesLine( &$rc, $watched = false, $linenumber = NULL ) { - global $wgContLang, $wgLang, $wgRCShowChangedSize, $wgUser; + global $wgLang, $wgRCShowChangedSize, $wgUser; wfProfileIn( __METHOD__ ); # Should patrol-related stuff be shown? $unpatrolled = $wgUser->useRCPatrol() && !$rc->mAttribs['rc_patrolled']; @@ -473,7 +480,7 @@ class EnhancedChangesList extends ChangesList { * Format a line for enhanced recentchange (aka with javascript and block of lines). */ public function recentChangesLine( &$baseRC, $watched = false ) { - global $wgLang, $wgContLang, $wgUser; + global $wgLang, $wgUser; wfProfileIn( __METHOD__ ); @@ -547,13 +554,14 @@ class EnhancedChangesList extends ChangesList { $showdifflinks = false; } - $time = $wgContLang->time( $rc_timestamp, true, true ); + $time = $wgLang->time( $rc_timestamp, true, true ); $rc->watched = $watched; $rc->link = $clink; $rc->timestamp = $time; $rc->numberofWatchingusers = $baseRC->numberofWatchingusers; - # Make "cur" and "diff" links + # Make "cur" and "diff" links. Don't use link(), it's too slow if + # called too many times (50% of CPU time on RecentChanges!). if( $rc->unpatrolled ) { $rcIdQuery = array( 'rcid' => $rc_id ); } else { @@ -562,21 +570,23 @@ class EnhancedChangesList extends ChangesList { $querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $rc_this_oldid ); $querydiff = $curIdEq + array( 'diff' => $rc_this_oldid, 'oldid' => $rc_last_oldid ) + $rcIdQuery; - $attribs = array( 'tabindex' => $baseRC->counter ); - # Make "diff" and "cur" links if( !$showdifflinks ) { $curLink = $this->message['cur']; $diffLink = $this->message['diff']; } else if( in_array( $rc_type, array(RC_NEW,RC_LOG,RC_MOVE,RC_MOVE_OVER_REDIRECT) ) ) { - $curLink = ($rc_type != RC_NEW) ? $this->message['cur'] - : $this->skin->linkKnown( $rc->getTitle(), $this->message['cur'], $attribs, $querycur ); + if ( $rc_type != RC_NEW ) { + $curLink = $this->message['cur']; + } else { + $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) ); + $curLink = "counter}\">{$this->message['cur']}"; + } $diffLink = $this->message['diff']; } else { - $diffLink = $this->skin->linkKnown( $rc->getTitle(), $this->message['diff'], - $attribs, $querydiff ); - $curLink = $this->skin->linkKnown( $rc->getTitle(), $this->message['cur'], - $attribs, $querycur ); + $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querydiff ) ); + $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) ); + $diffLink = "counter}\">{$this->message['diff']}"; + $curLink = "counter}\">{$this->message['cur']}"; } # Make "last" link @@ -915,7 +925,7 @@ class EnhancedChangesList extends ChangesList { * @return string a HTML formated line (generated using $r) */ protected function recentChangesBlockLine( $rcObj ) { - global $wgContLang, $wgRCShowChangedSize; + global $wgRCShowChangedSize; wfProfileIn( __METHOD__ );