r83823 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83822‎ | r83823 | r83824 >
Date:14:00, 13 March 2011
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
Make Parser::makeKnownLinkHolder() call Linker::linkKnown() instead of deprecated Linker::makeKnownLinkObj()
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -1932,7 +1932,7 @@
19331933 # batch file existence checks for NS_FILE and NS_MEDIA
19341934 if ( $iw == '' && $nt->isAlwaysKnown() ) {
19351935 $this->mOutput->addLink( $nt );
1936 - $s .= $this->makeKnownLinkHolder( $nt, $text, '', $trail, $prefix );
 1936+ $s .= $this->makeKnownLinkHolder( $nt, $text, array(), $trail, $prefix );
19371937 } else {
19381938 # Links will be added to the output link list after checking
19391939 $s .= $holders->makeHolder( $nt, $text, '', $trail, $prefix );
@@ -1964,16 +1964,26 @@
19651965 *
19661966 * @param $nt Title
19671967 * @param $text String
1968 - * @param $query String
 1968+ * @param $query Array or String
19691969 * @param $trail String
19701970 * @param $prefix String
19711971 * @return String: HTML-wikitext mix oh yuck
19721972 */
1973 - function makeKnownLinkHolder( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) {
 1973+ function makeKnownLinkHolder( $nt, $text = '', $query = array(), $trail = '', $prefix = '' ) {
19741974 list( $inside, $trail ) = Linker::splitTrail( $trail );
 1975+
 1976+ if ( is_string( $query ) ) {
 1977+ $query = wfCgiToArray( $query );
 1978+ }
 1979+
19751980 $sk = $this->mOptions->getSkin( $this->mTitle );
1976 - # FIXME: use link() instead of deprecated makeKnownLinkObj()
1977 - $link = $sk->makeKnownLinkObj( $nt, $text, $query, $inside, $prefix );
 1981+
 1982+ if ( $text == '' ) {
 1983+ $text = $sk->linkText( $title );
 1984+ }
 1985+
 1986+ $link = $sk->linkKnown( $nt, "$prefix$text$inside", array(), $query );
 1987+
19781988 return $this->armorLinks( $link ) . $trail;
19791989 }
19801990

Follow-up revisions

RevisionCommit summaryAuthorDate
r84324Fix fatal from r83823ialex13:00, 19 March 2011

Comments

#Comment by Reedy (talk | contribs)   01:25, 19 March 2011

$title is undefined

$sk->linkText() is a private method

#Comment by IAlex (talk | contribs)   13:01, 19 March 2011

Fixed in r84324.

Status & tagging log