r8021 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r8020‎ | r8021 | r8022 >
Date:15:46, 1 April 2005
Author:avar
Status:old
Tags:
Comment:
* Fixed the breakage of the invert feature (see @@ -240,7 +239,7 @@)
* Removed all this intval() nonsense except for the one instance where it
wasn't redundant
Modified paths:
  • /trunk/phase3/includes/SpecialAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialAllpages.php
@@ -88,15 +88,14 @@
8989 global $wgOut, $indexMaxperpage, $toplevelMaxperpage, $wgContLang, $wgRequest, $wgUser;
9090 $sk = $wgUser->getSkin();
9191 $fname = "indexShowToplevel";
92 - $namespace = intval ($namespace);
9392
9493 # TODO: Either make this *much* faster or cache the title index points
9594 # in the querycache table.
9695
9796 $dbr =& wfGetDB( DB_SLAVE );
9897 $page = $dbr->tableName( 'page' );
99 - $invsql = ($invert) ? '!' : '';
100 - $fromwhere = "FROM $page WHERE page_namespace$invsql=$namespace";
 98+ $fromwhere = "FROM $page WHERE page_namespace" .
 99+ ($invert ? '!' : '') . "=$namespace";
101100 $order_arr = array ( 'ORDER BY' => 'page_title' );
102101 $order_str = 'ORDER BY page_title';
103102 $out = "";
@@ -199,7 +198,7 @@
200199
201200 $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
202201 $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
203 - $queryparams = ($namespace ? ('namespace='.intval($namespace)) : '') . ($invert ? "&invert=$invert" : '');
 202+ $queryparams = ($namespace ? "namespace=$namespace" : '') . ($invert ? "&invert=$invert" : '');
204203 $special = Title::makeTitle( NS_SPECIAL, 'Allpages/' . $inpoint );
205204 $link = $special->escapeLocalUrl( $queryparams );
206205
@@ -220,7 +219,6 @@
221220 global $wgOut, $wgUser, $indexMaxperpage, $wgContLang;
222221 $sk = $wgUser->getSkin();
223222 $maxPlusOne = $indexMaxperpage + 1;
224 - $namespacee = intval($namespace);
225223
226224 $out = '';
227225 $dbr =& wfGetDB( DB_SLAVE );
@@ -229,8 +227,8 @@
230228 $fromTitle = Title::newFromURL( $from );
231229 $fromKey = is_null( $fromTitle ) ? '' : $fromTitle->getDBkey();
232230
233 - $invsql = ($invert) ? '!' : '';
234 - $sql = "SELECT page_title FROM $page WHERE page_namespace$invsql=$namespacee" .
 231+ $sql = "SELECT page_namespace, page_title FROM $page WHERE page_namespace" .
 232+ ($invert ? '!' : '') . "=$namespace" .
235233 " AND page_title >= ". $dbr->addQuotes( $fromKey ) .
236234 " ORDER BY page_title LIMIT " . $maxPlusOne;
237235 $res = $dbr->query( $sql, 'indexShowChunk' );
@@ -240,7 +238,7 @@
241239 $n = 0;
242240 $out = '<table style="background: inherit;" border="0" width="100%">';
243241 while( ($n < $indexMaxperpage) && ($s = $dbr->fetchObject( $res )) ) {
244 - $t = Title::makeTitle( $namespacee, $s->page_title );
 242+ $t = Title::makeTitle( $s->page_namespace, $s->page_title );
245243 if( $t ) {
246244 $link = $sk->makeKnownLinkObj( $t, $t->getText() );
247245 } else {

Status & tagging log