Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php |
— | — | @@ -29,6 +29,15 @@ |
30 | 30 | $defaultNS = empty($wgFlaggedRevsNamespaces) ? 0 : $wgFlaggedRevsNamespaces[0]; |
31 | 31 | $namespace = $wgRequest->getIntOrNull( 'namespace', $defaultNS ); |
32 | 32 | $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 ); |
33 | 42 | |
34 | 43 | $action = htmlspecialchars( $wgScript ); |
35 | 44 | $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" . |
— | — | @@ -37,9 +46,11 @@ |
38 | 47 | if( count($wgFlaggedRevsNamespaces) > 1 ) { |
39 | 48 | $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $namespace ) . ' ' ); |
40 | 49 | } |
41 | | - $wgOut->addHTML( Xml::label( wfMsg("unreviewed-category"), 'category' ) . |
42 | | - ' ' . Xml::input( 'category', 35, $category, array('id' => 'category') ) . |
43 | | - ' ' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" . |
| 50 | + $wgOut->addHTML( |
| 51 | + Xml::label( wfMsg("unreviewed-category"), 'category' ) . ' ' . |
| 52 | + Xml::input( 'category', 30, $category, array('id' => 'category') ) . '<br/>' . |
| 53 | + $showhideredirs . ' ' . |
| 54 | + Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" . |
44 | 55 | "</fieldset></form>" |
45 | 56 | ); |
46 | 57 | # This will start to get slower if live... |
— | — | @@ -55,7 +66,7 @@ |
56 | 67 | $wgOut->addHTML( wfMsg( 'perfcached' ) ); |
57 | 68 | } |
58 | 69 | } |
59 | | - $pager = new UnreviewedPagesPager( $this, $live, $namespace, $category ); |
| 70 | + $pager = new UnreviewedPagesPager( $this, $live, $namespace, !$hideRedirs, $category ); |
60 | 71 | if( $pager->getNumRows() ) { |
61 | 72 | $wgOut->addHTML( wfMsgExt('unreviewed-list', array('parse') ) ); |
62 | 73 | $wgOut->addHTML( $pager->getNavigationBar() ); |
— | — | @@ -129,7 +140,9 @@ |
130 | 141 | # Get est. of fraction of pages that are reviewed |
131 | 142 | $dbr = wfGetDB( DB_SLAVE ); |
132 | 143 | $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__ ); |
134 | 147 | $ratio = $pages/($pages - $reviewedpages); |
135 | 148 | # If dist. is normalized, # of rows scanned = $ratio * LIMIT (or until list runs out) |
136 | 149 | return ($ratio <= 1000); |
— | — | @@ -141,9 +154,9 @@ |
142 | 155 | */ |
143 | 156 | class UnreviewedPagesPager extends AlphabeticPager { |
144 | 157 | public $mForm, $mConds; |
145 | | - private $live, $namespace, $category; |
| 158 | + private $live, $namespace, $category, $showredirs; |
146 | 159 | |
147 | | - function __construct( $form, $live, $namespace, $category=NULL ) { |
| 160 | + function __construct( $form, $live, $namespace, $redirs=false, $category=NULL ) { |
148 | 161 | $this->mForm = $form; |
149 | 162 | $this->live = (bool)$live; |
150 | 163 | # Must be a content page... |
— | — | @@ -156,7 +169,7 @@ |
157 | 170 | } |
158 | 171 | $this->namespace = $namespace; |
159 | 172 | $this->category = $category ? str_replace(' ','_',$category) : NULL; |
160 | | - |
| 173 | + $this->showredirs = (bool)$redirs; |
161 | 174 | parent::__construct(); |
162 | 175 | // Don't get to expensive |
163 | 176 | $this->mLimitsShown = array( 20, 50 ); |
— | — | @@ -177,7 +190,9 @@ |
178 | 191 | # Reviewable pages only |
179 | 192 | $conds['page_namespace'] = $this->namespace; |
180 | 193 | # No redirects |
181 | | - $conds['page_is_redirect'] = 0; |
| 194 | + if( !$this->showredirs ) { |
| 195 | + $conds['page_is_redirect'] = 0; |
| 196 | + } |
182 | 197 | # Filter by category |
183 | 198 | if( $this->category ) { |
184 | 199 | $tables = array( 'categorylinks', 'page', 'flaggedpages' ); |