- $linkCache = MediaWikiServices::getInstance()->getLinkCache();
- // Make sure the target is in the cache
- $id = $linkCache->addLinkObj( $t );
- if ( $id == 0 ) {
- // Doesn't exist
- return '';
- }
-
- if ( $linkCache->getGoodLinkFieldObj( $t, 'redirect' ) ) {
- # Page is a redirect
- return 'mw-redirect';
- } elseif ( $threshold > 0 && MWNamespace::isContent( $t->getNamespace() )
- && $linkCache->getGoodLinkFieldObj( $t, 'length' ) < $threshold
- ) {
- # Page is a stub
- return 'stub';
+ wfDeprecated( __METHOD__, '1.28' );
+ $services = MediaWikiServices::getInstance();
+ $linkRenderer = $services->getLinkRenderer();
+ if ( $threshold !== $linkRenderer->getStubThreshold() ) {
+ // Need to create a new instance with the right stub threshold...
+ $linkRenderer = $services->getLinkRendererFactory()->create();
+ $linkRenderer->setStubThreshold( $threshold );