From 63601400e476c6cf43d985f3e7b9864681695ed4 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 18 Jan 2013 16:46:04 +0100 Subject: Update to MediaWiki 1.20.2 this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024 --- includes/specials/SpecialShortpages.php | 55 ++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 22 deletions(-) (limited to 'includes/specials/SpecialShortpages.php') diff --git a/includes/specials/SpecialShortpages.php b/includes/specials/SpecialShortpages.php index c176f913..5a4e8f03 100644 --- a/includes/specials/SpecialShortpages.php +++ b/includes/specials/SpecialShortpages.php @@ -40,10 +40,11 @@ class ShortPagesPage extends QueryPage { function getQueryInfo() { return array ( 'tables' => array ( 'page' ), - 'fields' => array ( 'page_namespace AS namespace', - 'page_title AS title', - 'page_len AS value' ), - 'conds' => array ( 'page_namespace' => NS_MAIN, + 'fields' => array ( 'namespace' => 'page_namespace', + 'title' => 'page_title', + 'value' => 'page_len' ), + 'conds' => array ( 'page_namespace' => + MWNamespace::getContentNamespaces(), 'page_is_redirect' => 0 ), 'options' => array ( 'USE INDEX' => 'page_redirect_namespace_len' ) ); @@ -61,16 +62,17 @@ class ShortPagesPage extends QueryPage { function preprocessResults( $db, $res ) { # There's no point doing a batch check if we aren't caching results; # the page must exist for it to have been pulled out of the table - if( $this->isCached() ) { - $batch = new LinkBatch(); - foreach ( $res as $row ) { - $batch->add( $row->namespace, $row->title ); - } - $batch->execute(); - if ( $db->numRows( $res ) > 0 ) { - $db->dataSeek( $res, 0 ); - } + if ( !$this->isCached() || !$res->numRows() ) { + return; } + + $batch = new LinkBatch(); + foreach ( $res as $row ) { + $batch->add( $row->namespace, $row->title ); + } + $batch->execute(); + + $res->seek( 0 ); } function sortDescending() { @@ -80,23 +82,32 @@ class ShortPagesPage extends QueryPage { function formatResult( $skin, $result ) { $dm = $this->getLanguage()->getDirMark(); - $title = Title::makeTitle( $result->namespace, $result->title ); + $title = Title::makeTitleSafe( $result->namespace, $result->title ); if ( !$title ) { - return ''; + return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), + Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) ); } + $hlink = Linker::linkKnown( $title, - wfMsgHtml( 'hist' ), + $this->msg( 'hist' )->escaped(), array(), array( 'action' => 'history' ) ); - $plink = $this->isCached() - ? Linker::link( $title ) - : Linker::linkKnown( $title ); + $hlinkInParentheses = $this->msg( 'parentheses' )->rawParams( $hlink )->escaped(); + + if ( $this->isCached() ) { + $plink = Linker::link( $title ); + $exists = $title->exists(); + } else { + $plink = Linker::linkKnown( $title ); + $exists = true; + } + $size = $this->msg( 'nbytes' )->numParams( $result->value )->escaped(); - return $title->exists() - ? "({$hlink}) {$dm}{$plink} {$dm}[{$size}]" - : "({$hlink}) {$dm}{$plink} {$dm}[{$size}]"; + return $exists + ? "${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]" + : "${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]"; } } -- cgit v1.2.2