diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /includes/specials/SpecialWhatlinkshere.php | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'includes/specials/SpecialWhatlinkshere.php')
-rw-r--r-- | includes/specials/SpecialWhatlinkshere.php | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index f7d7bfef..d5129bf6 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -47,8 +47,9 @@ class SpecialWhatLinksHere extends SpecialPage { } function execute( $par ) { + global $wgQueryPageDefaultLimit; $out = $this->getOutput(); - + $this->setHeaders(); $this->outputHeader(); @@ -56,7 +57,7 @@ class SpecialWhatLinksHere extends SpecialPage { $opts->add( 'target', '' ); $opts->add( 'namespace', '', FormOptions::INTNULL ); - $opts->add( 'limit', 50 ); + $opts->add( 'limit', $wgQueryPageDefaultLimit ); $opts->add( 'from', 0 ); $opts->add( 'back', 0 ); $opts->add( 'hideredirs', false ); @@ -83,11 +84,10 @@ class SpecialWhatLinksHere extends SpecialPage { $this->getSkin()->setRelevantTitle( $this->target ); - $this->selfTitle = $this->getTitle( $this->target->getPrefixedDBkey() ); - $out->setPageTitle( wfMsg( 'whatlinkshere-title', $this->target->getPrefixedText() ) ); - $out->setSubtitle( wfMsg( 'whatlinkshere-backlink', Linker::link( $this->target, $this->target->getPrefixedText(), array(), array( 'redirect' => 'no' ) ) ) ); + $out->setPageTitle( $this->msg( 'whatlinkshere-title', $this->target->getPrefixedText() ) ); + $out->addBacklinkSubtitle( $this->target ); $this->showIndirectLinks( 0, $this->target, $opts->getValue( 'limit' ), $opts->getValue( 'from' ), $opts->getValue( 'back' ) ); @@ -120,9 +120,9 @@ class SpecialWhatLinksHere extends SpecialPage { 'pl_title' => $target->getDBkey(), ); if( $hideredirs ) { - $plConds['page_is_redirect'] = 0; + $plConds['rd_from'] = null; } elseif( $hidelinks ) { - $plConds['page_is_redirect'] = 1; + $plConds[] = 'rd_from is NOT NULL'; } $tlConds = array( @@ -157,24 +157,34 @@ class SpecialWhatLinksHere extends SpecialPage { $options[] = 'STRAIGHT_JOIN'; $options['LIMIT'] = $queryLimit; - $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect' ); + $fields = array( 'page_id', 'page_namespace', 'page_title', 'rd_from' ); + + $joinConds = array( 'redirect' => array( 'LEFT JOIN', array( + 'rd_from = page_id', + 'rd_namespace' => $target->getNamespace(), + 'rd_title' => $target->getDBkey(), + '(rd_interwiki is NULL) or (rd_interwiki = \'\')' + ))); if( $fetchlinks ) { $options['ORDER BY'] = 'pl_from'; - $plRes = $dbr->select( array( 'pagelinks', 'page' ), $fields, - $plConds, __METHOD__, $options ); + $plRes = $dbr->select( array( 'pagelinks', 'page', 'redirect' ), $fields, + $plConds, __METHOD__, $options, + $joinConds); } if( !$hidetrans ) { $options['ORDER BY'] = 'tl_from'; - $tlRes = $dbr->select( array( 'templatelinks', 'page' ), $fields, - $tlConds, __METHOD__, $options ); + $tlRes = $dbr->select( array( 'templatelinks', 'page', 'redirect' ), $fields, + $tlConds, __METHOD__, $options, + $joinConds); } if( !$hideimages ) { $options['ORDER BY'] = 'il_from'; - $ilRes = $dbr->select( array( 'imagelinks', 'page' ), $fields, - $ilConds, __METHOD__, $options ); + $ilRes = $dbr->select( array( 'imagelinks', 'page', 'redirect' ), $fields, + $ilConds, __METHOD__, $options, + $joinConds); } if( ( !$fetchlinks || !$dbr->numRows($plRes) ) && ( $hidetrans || !$dbr->numRows($tlRes) ) && ( $hideimages || !$dbr->numRows($ilRes) ) ) { @@ -248,7 +258,7 @@ class SpecialWhatLinksHere extends SpecialPage { foreach ( $rows as $row ) { $nt = Title::makeTitle( $row->page_namespace, $row->page_title ); - if ( $row->page_is_redirect && $level < 2 ) { + if ( $row->rd_from && $level < 2 ) { $out->addHTML( $this->listItem( $row, $nt, true ) ); $this->showIndirectLinks( $level + 1, $nt, $wgMaxRedirectLinksRetrieved ); $out->addHTML( Xml::closeElement( 'li' ) ); @@ -269,8 +279,7 @@ class SpecialWhatLinksHere extends SpecialPage { } protected function listItem( $row, $nt, $notClose = false ) { - global $wgLang; - $dirmark = $wgLang->getDirMark(); + $dirmark = $this->getLanguage()->getDirMark(); # local message cache static $msgcache = null; @@ -283,7 +292,7 @@ class SpecialWhatLinksHere extends SpecialPage { } } - if( $row->page_is_redirect ) { + if( $row->rd_from ) { $query = array( 'redirect' => 'no' ); } else { $query = array(); @@ -299,7 +308,7 @@ class SpecialWhatLinksHere extends SpecialPage { // Display properties (redirect or template) $propsText = ''; $props = array(); - if ( $row->page_is_redirect ) + if ( $row->rd_from ) $props[] = $msgcache['isredirect']; if ( $row->is_template ) $props[] = $msgcache['istemplate']; @@ -346,11 +355,9 @@ class SpecialWhatLinksHere extends SpecialPage { } function getPrevNext( $prevId, $nextId ) { - global $wgLang; $currentLimit = $this->opts->getValue( 'limit' ); - $fmtLimit = $wgLang->formatNum( $currentLimit ); - $prev = wfMsgExt( 'whatlinkshere-prev', array( 'parsemag', 'escape' ), $fmtLimit ); - $next = wfMsgExt( 'whatlinkshere-next', array( 'parsemag', 'escape' ), $fmtLimit ); + $prev = wfMessage( 'whatlinkshere-prev' )->numParams( $currentLimit )->escaped(); + $next = wfMessage( 'whatlinkshere-next' )->numParams( $currentLimit )->escaped(); $changed = $this->opts->getChangedValues(); unset($changed['target']); // Already in the request title @@ -365,13 +372,14 @@ class SpecialWhatLinksHere extends SpecialPage { } $limitLinks = array(); + $lang = $this->getLanguage(); foreach ( $this->limits as $limit ) { - $prettyLimit = $wgLang->formatNum( $limit ); + $prettyLimit = htmlspecialchars( $lang->formatNum( $limit ) ); $overrides = array( 'limit' => $limit ); $limitLinks[] = $this->makeSelfLink( $prettyLimit, array_merge( $changed, $overrides ) ); } - $nums = $wgLang->pipeList( $limitLinks ); + $nums = $lang->pipeList( $limitLinks ); return wfMsgHtml( 'viewprevnext', $prev, $next, $nums ); } @@ -425,7 +433,6 @@ class SpecialWhatLinksHere extends SpecialPage { * @return string HTML fieldset and filter panel with the show/hide links */ function getFilterPanel() { - global $wgLang; $show = wfMsgHtml( 'show' ); $hide = wfMsgHtml( 'hide' ); @@ -445,6 +452,6 @@ class SpecialWhatLinksHere extends SpecialPage { $overrides = array( $type => !$chosen ); $links[] = wfMsgHtml( "whatlinkshere-{$type}", $this->makeSelfLink( $msg, array_merge( $changed, $overrides ) ) ); } - return Xml::fieldset( wfMsg( 'whatlinkshere-filters' ), $wgLang->pipeList( $links ) ); + return Xml::fieldset( wfMsg( 'whatlinkshere-filters' ), $this->getLanguage()->pipeList( $links ) ); } } |