r4724 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r4723‎ | r4724 | r4725 >
Date:00:56, 13 August 2004
Author:timwi
Status:old
Tags:
Comment:
Allow an optional &namespace= parameter for Special:Allpages.
Might need some UI.
Modified paths:
  • /trunk/phase3/includes/SpecialAllpages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialAllpages.php
@@ -5,11 +5,13 @@
66 global $indexMaxperpage, $wgRequest;
77 $indexMaxperpage = 480;
88 $from = $wgRequest->getVal( 'from' );
9 -
 9+ $namespace = $wgRequest->getVal( 'namespace' );
 10+ if ( is_null($namespace) ) { $namespace = 0; }
 11+
1012 if( $par ) {
11 - indexShowChunk( $par );
 13+ indexShowChunk( $par, $namespace );
1214 } elseif( !is_null( $from ) ) {
13 - indexShowChunk( $from );
 15+ indexShowChunk( $from, $namespace );
1416 } else {
1517 indexShowToplevel();
1618 }
@@ -30,7 +32,7 @@
3133 $log->showAsDisabledPage();
3234 return;
3335 }
34 -
 36+
3537 $dbr =& wfGetDB( DB_SLAVE );
3638 $cur = $dbr->tableName( 'cur' );
3739 $fromwhere = "FROM $cur WHERE cur_namespace=0";
@@ -41,7 +43,7 @@
4244 $count = $dbr->selectField( 'cur', 'COUNT(*)', $where, $fname );
4345 $sections = ceil( $count / $indexMaxperpage );
4446 $inpoint = $dbr->selectField( 'cur', 'cur_title', $where, $fname, $order );
45 -
 47+
4648 $out .= "<table>\n";
4749 # There's got to be a cleaner way to do this!
4850 for( $i = 1; $i < $sections; $i++ ) {
@@ -91,16 +93,17 @@
9294 return "<tr><td align=\"right\">{$out}</td></tr>\n";
9395 }
9496
95 -function indexShowChunk( $from )
 97+function indexShowChunk( $from, $namespace = 0 )
9698 {
9799 global $wgOut, $wgUser, $indexMaxperpage, $wgLang;
98100 $sk = $wgUser->getSkin();
99101 $maxPlusOne = $indexMaxperpage + 1;
 102+ $namespacee = intval($namespace);
100103
101104 $out = "";
102105 $dbr =& wfGetDB( DB_SLAVE );
103106 $cur = $dbr->tableName( 'cur' );
104 - $sql = "SELECT cur_title FROM $cur WHERE cur_namespace=0 AND cur_title >= '"
 107+ $sql = "SELECT cur_title FROM $cur WHERE cur_namespace=$namespacee AND cur_title >= '"
105108 . $dbr->strencode( $from ) . "' ORDER BY cur_title LIMIT " . $maxPlusOne;
106109 $res = $dbr->query( $sql, "indexShowChunk" );
107110
@@ -109,7 +112,7 @@
110113 $n = 0;
111114 $out = "<table border=\"0\" width=\"100%\">\n";
112115 while( ($n < $indexMaxperpage) && ($s = $dbr->fetchObject( $res )) ) {
113 - $t = Title::makeTitle( 0, $s->cur_title );
 116+ $t = Title::makeTitle( $namespacee, $s->cur_title );
114117 if( $t ) {
115118 $link = $sk->makeKnownLinkObj( $t );
116119 } else {

Status & tagging log