From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- includes/specials/SpecialAllmessages.php | 84 ++++++++++++-------------------- 1 file changed, 32 insertions(+), 52 deletions(-) (limited to 'includes/specials/SpecialAllmessages.php') diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index 1745bf6c..296c6f50 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -1,6 +1,29 @@ 'get', 'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) . Xml::fieldset( wfMsg( 'allmessages-filter-legend' ) ) . - Xml::hidden( 'title', $this->getTitle() ) . + Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . Xml::openElement( 'table', array( 'class' => 'mw-allmessages-table' ) ) . "\n" . ' ' . @@ -77,19 +100,19 @@ class SpecialAllmessages extends SpecialPage { 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', - ( $this->filter == 'unmodified' ? true : false ) + ( $this->filter == 'unmodified' ) ) . Xml::radioLabel( wfMsg( 'allmessages-filter-all' ), 'filter', 'all', 'mw-allmessages-form-filter-all', - ( $this->filter == 'all' ? true : false ) + ( $this->filter == 'all' ) ) . Xml::radioLabel( wfMsg( 'allmessages-filter-modified' ), 'filter', 'modified', 'mw-allmessages-form-filter-modified', - ( $this->filter == 'modified' ? true : false ) + ( $this->filter == 'modified' ) ) . "\n @@ -101,7 +124,7 @@ class SpecialAllmessages extends SpecialPage { Xml::openElement( 'select', array( 'id' => 'mw-allmessages-form-lang', 'name' => 'lang' ) ); foreach( $languages as $lang => $name ) { - $selected = $lang == $this->langCode ? true : false; + $selected = $lang == $this->langCode; $out .= Xml::option( $lang . ' - ' . $name, $lang, $selected ) . "\n"; } $out .= Xml::closeElement( 'select' ) . @@ -134,10 +157,7 @@ class AllmessagesTablePager extends TablePager { $this->mPage = $page; $this->mConds = $conds; $this->mDefaultDirection = true; // always sort ascending - // We want to have an option for people to view *all* the messages, - // so they can use Ctrl+F to search them. 5000 is the maximum that - // will get through WebRequest::getLimitOffset(). - $this->mLimitsShown = array( 20, 50, 100, 250, 500, 5000 => wfMsg('limitall') ); + $this->mLimitsShown = array( 20, 50, 100, 250, 500, 5000 ); global $wgLang, $wgContLang, $wgRequest; @@ -182,8 +202,8 @@ class AllmessagesTablePager extends TablePager { // Normalise message names so they look like page titles $messageNames = array_map( array( $this->lang, 'ucfirst' ), $messageNames ); - wfProfileIn( __METHOD__ ); + wfProfileOut( __METHOD__ ); return $messageNames; } @@ -207,7 +227,7 @@ class AllmessagesTablePager extends TablePager { $pageFlags = $talkFlags = array(); - while( $s = $dbr->fetchObject( $res ) ) { + foreach ( $res as $s ) { if( $s->page_namespace == NS_MEDIAWIKI ) { if( $this->foreign ) { $title = explode( '/', $s->page_title ); @@ -223,7 +243,6 @@ class AllmessagesTablePager extends TablePager { $talkFlags[$s->page_title] = true; } } - $dbr->freeResult( $res ); wfProfileOut( __METHOD__ . '-db' ); @@ -327,7 +346,7 @@ class AllmessagesTablePager extends TablePager { $s .= Xml::openElement( 'tr', $this->getRowAttrs( $row, true ) ); $formatted = strval( $this->formatValue( 'am_actual', $row->am_actual ) ); if ( $formatted == '' ) { - $formatted = ' '; + $formatted = ' '; } $s .= Xml::tags( 'td', $this->getCellAttrs( 'am_actual', $row->am_actual ), $formatted ) . "\n"; @@ -375,43 +394,4 @@ class AllmessagesTablePager extends TablePager { return ''; } } -/* Overloads the relevant methods of the real ResultsWrapper so it - * doesn't go anywhere near an actual database. - */ -class FakeResultWrapper extends ResultWrapper { - - var $result = array(); - var $db = null; // And it's going to stay that way :D - var $pos = 0; - var $currentRow = null; - function __construct( $array ){ - $this->result = $array; - } - - function numRows() { - return count( $this->result ); - } - - function fetchRow() { - $this->currentRow = $this->result[$this->pos++]; - return $this->currentRow; - } - - function seek( $row ) { - $this->pos = $row; - } - - function free() {} - - // Callers want to be able to access fields with $this->fieldName - function fetchObject(){ - $this->currentRow = $this->result[$this->pos++]; - return (object)$this->currentRow; - } - - function rewind() { - $this->pos = 0; - $this->currentRow = null; - } -} -- cgit v1.2.2