r44866 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44865‎ | r44866 | r44867 >
Date:03:21, 21 December 2008
Author:aaron
Status:deferred
Tags:
Comment:
(bug 16727) FlaggedRevs: Add option to Special:UnreviewedPages to show redirects
Modified paths:
  • /trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
@@ -29,6 +29,15 @@
3030 $defaultNS = empty($wgFlaggedRevsNamespaces) ? 0 : $wgFlaggedRevsNamespaces[0];
3131 $namespace = $wgRequest->getIntOrNull( 'namespace', $defaultNS );
3232 $category = trim( $wgRequest->getVal( 'category' ) );
 33+ $hideRedirs = $wgRequest->getBool( 'hideredirs', true );
 34+
 35+ // show/hide links
 36+ $showhide = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
 37+ $onoff = 1 - $hideRedirs;
 38+ $link = $this->skin->link( $this->getTitle(), $showhide[$onoff], array(),
 39+ array( 'hideredirs' => $onoff, 'category' => $category )
 40+ );
 41+ $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link );
3342
3443 $action = htmlspecialchars( $wgScript );
3544 $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
@@ -37,9 +46,11 @@
3847 if( count($wgFlaggedRevsNamespaces) > 1 ) {
3948 $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $namespace ) . '&nbsp;' );
4049 }
41 - $wgOut->addHTML( Xml::label( wfMsg("unreviewed-category"), 'category' ) .
42 - ' ' . Xml::input( 'category', 35, $category, array('id' => 'category') ) .
43 - '&nbsp;&nbsp;' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
 50+ $wgOut->addHTML(
 51+ Xml::label( wfMsg("unreviewed-category"), 'category' ) . '&nbsp;' .
 52+ Xml::input( 'category', 30, $category, array('id' => 'category') ) . '<br/>' .
 53+ $showhideredirs . '&nbsp;&nbsp;' .
 54+ Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
4455 "</fieldset></form>"
4556 );
4657 # This will start to get slower if live...
@@ -55,7 +66,7 @@
5667 $wgOut->addHTML( wfMsg( 'perfcached' ) );
5768 }
5869 }
59 - $pager = new UnreviewedPagesPager( $this, $live, $namespace, $category );
 70+ $pager = new UnreviewedPagesPager( $this, $live, $namespace, !$hideRedirs, $category );
6071 if( $pager->getNumRows() ) {
6172 $wgOut->addHTML( wfMsgExt('unreviewed-list', array('parse') ) );
6273 $wgOut->addHTML( $pager->getNavigationBar() );
@@ -129,7 +140,9 @@
130141 # Get est. of fraction of pages that are reviewed
131142 $dbr = wfGetDB( DB_SLAVE );
132143 $reviewedpages = $dbr->estimateRowCount( 'flaggedpages', '*', array(), __METHOD__ );
133 - $pages = $dbr->estimateRowCount( 'page', '*', array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ );
 144+ $pages = $dbr->estimateRowCount( 'page', '*',
 145+ array('page_namespace' => $wgFlaggedRevsNamespaces),
 146+ __METHOD__ );
134147 $ratio = $pages/($pages - $reviewedpages);
135148 # If dist. is normalized, # of rows scanned = $ratio * LIMIT (or until list runs out)
136149 return ($ratio <= 1000);
@@ -141,9 +154,9 @@
142155 */
143156 class UnreviewedPagesPager extends AlphabeticPager {
144157 public $mForm, $mConds;
145 - private $live, $namespace, $category;
 158+ private $live, $namespace, $category, $showredirs;
146159
147 - function __construct( $form, $live, $namespace, $category=NULL ) {
 160+ function __construct( $form, $live, $namespace, $redirs=false, $category=NULL ) {
148161 $this->mForm = $form;
149162 $this->live = (bool)$live;
150163 # Must be a content page...
@@ -156,7 +169,7 @@
157170 }
158171 $this->namespace = $namespace;
159172 $this->category = $category ? str_replace(' ','_',$category) : NULL;
160 -
 173+ $this->showredirs = (bool)$redirs;
161174 parent::__construct();
162175 // Don't get to expensive
163176 $this->mLimitsShown = array( 20, 50 );
@@ -177,7 +190,9 @@
178191 # Reviewable pages only
179192 $conds['page_namespace'] = $this->namespace;
180193 # No redirects
181 - $conds['page_is_redirect'] = 0;
 194+ if( !$this->showredirs ) {
 195+ $conds['page_is_redirect'] = 0;
 196+ }
182197 # Filter by category
183198 if( $this->category ) {
184199 $tables = array( 'categorylinks', 'page', 'flaggedpages' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r44870FlaggedRevs: In lieu of r44866, add orfilterredir to list=oldreviewedpagescatrope12:48, 21 December 2008

Status & tagging log