X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FLinker.php;h=8682991bf83a9410335f5c7246e36d25604d5f40;hb=e5999cc51d196a8b8f3ad403fdf1187197e8282d;hp=f8b1baef131d89e14524a06c99b6bc66950b657b;hpb=a206443c0e0f8efbdbc9b2e0a6b201a3a3527dd9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Linker.php b/includes/Linker.php index f8b1baef13..8682991bf8 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1804,7 +1804,7 @@ class Linker { return null; } - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); // Up to the value of $wgShowRollbackEditCount revisions are counted $res = $dbr->select( @@ -1919,6 +1919,8 @@ class Linker { } /** + * @deprecated since 1.28, use TemplatesOnThisPageFormatter directly + * * Returns HTML for the "templates used on this page" list. * * Make an HTML list of templates, and then add a "More..." link at @@ -1937,87 +1939,24 @@ class Linker { public static function formatTemplates( $templates, $preview = false, $section = false, $more = null ) { - global $wgLang; - - $outText = ''; - if ( count( $templates ) > 0 ) { - # Do a batch existence check - $batch = new LinkBatch; - foreach ( $templates as $title ) { - $batch->addObj( $title ); - } - $batch->execute(); - - # Construct the HTML - $outText = '
'; - if ( $preview ) { - $outText .= wfMessage( 'templatesusedpreview' )->numParams( count( $templates ) ) - ->parseAsBlock(); - } elseif ( $section ) { - $outText .= wfMessage( 'templatesusedsection' )->numParams( count( $templates ) ) - ->parseAsBlock(); - } else { - $outText .= wfMessage( 'templatesused' )->numParams( count( $templates ) ) - ->parseAsBlock(); - } - $outText .= "
'; + if ( $more instanceof Message ) { + $more = $more->toString(); } - return $outText; + + $formatter = new TemplatesOnThisPageFormatter( + RequestContext::getMain(), + MediaWikiServices::getInstance()->getLinkRenderer() + ); + return $formatter->format( $templates, $type, $more ); } /** @@ -2049,6 +1988,8 @@ class Linker { } /** + * @deprecated since 1.28, use Language::formatSize() directly + * * Format a size in bytes for output, using an appropriate * unit (B, KB, MB or GB) according to the magnitude in question * @@ -2057,6 +1998,8 @@ class Linker { * @return string */ public static function formatSize( $size ) { + wfDeprecated( __METHOD__, '1.28' ); + global $wgLang; return htmlspecialchars( $wgLang->formatSize( $size ) ); }