From: Platonides Date: Mon, 2 Aug 2010 15:53:22 +0000 (+0000) Subject: Check the link color (stub, redirect) on just one place. X-Git-Tag: 1.31.0-rc.0~35777 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=eee4d13325626f966be8b3e14a4468177e84b918;p=lhc%2Fweb%2Fwiklou.git Check the link color (stub, redirect) on just one place. Deprecate makeSizeLinkObj. The only usage is in CategoryPage, which we can change to link() without penalty, since the created Title is already loaded with its length. --- diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php index fb08ad8c41..2b6a4c1be1 100644 --- a/includes/CategoryPage.php +++ b/includes/CategoryPage.php @@ -236,7 +236,7 @@ class CategoryViewer { array(), array( 'known', 'noclasses' ) ) . '' - : $this->getSkin()->makeSizeLinkObj( $pageLength, $title ); + : $this->getSkin()->link( $title ); if ( $wgExperimentalCategorySort ) { $this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstLetterForLists( $sortkey ) ); diff --git a/includes/Linker.php b/includes/Linker.php index 1a9e9cf876..2795a8b45b 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -112,7 +112,7 @@ class Linker { $colour = 'mw-redirect'; } elseif ( $threshold > 0 && $t->exists() && $t->getLength() < $threshold && - MWNamespace::isContent( $t->getNamespace() ) ) { + $t->isContentPage() ) { # Page is a stub $colour = 'stub'; } @@ -266,14 +266,10 @@ class Linker { $classes[] = 'extiw'; } - # Note that redirects never count as stubs here. - if ( !in_array( 'broken', $options ) && $target->isRedirect() ) { - $classes[] = 'mw-redirect'; - } elseif( $target->isContentPage() ) { - # Check for stub. - $threshold = $wgUser->getOption( 'stubthreshold' ); - if( $threshold > 0 and $target->exists() and $target->getLength() < $threshold ) { - $classes[] = 'stub'; + if ( !in_array( 'broken', $options ) ) { # Avoid useless calls to LinkCache (see r50387) + $colour = $this->getLinkColour( $target, $wgUser->getOption( 'stubthreshold' ) ); + if ( $colour !== '' ) { + $classes[] = $colour; # mw-redirect or stub } } if( $classes != array() ) { @@ -335,9 +331,12 @@ class Linker { * @param $trail String * @param $prefix String * @return string HTML of link + * @deprecated */ function makeSizeLinkObj( $size, $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { global $wgUser; + wfDeprecated( __METHOD__ ); + $threshold = intval( $wgUser->getOption( 'stubthreshold' ) ); $colour = ( $size < $threshold ) ? 'stub' : ''; // FIXME: replace deprecated makeColouredLinkObj by link() @@ -1950,6 +1949,7 @@ class Linker { * @param $prefix String: Optional prefix */ function makeColouredLinkObj( $nt, $colour, $text = '', $query = '', $trail = '', $prefix = '' ) { + wfDeprecated( __METHOD__ ); if($colour != ''){ $style = $this->getInternalLinkAttributesObj( $nt, $text, $colour ); } else $style = '';