r59679 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59678‎ | r59679 | r59680 >
Date:21:21, 2 December 2009
Author:aaron
Status:ok
Tags:
Comment:
* Use getNamespaces() rather than global
* Made generalQueryOK() check if NS array is empty
* Removed unused vars
* Spacing tweaks
* Use /*_*/ in place of longer /*$wgDBPrefix*/
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.sql (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiQueryReviewedpages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ProblemChanges_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/UnstablePages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ValidationStatistics_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql
@@ -1,10 +1,10 @@
22 -- (c) Aaron Schulz, 2007-2009, GPL
33 -- Table structure for table `Flagged Revisions`
 4+-- Replace /*_*/ with the proper prefix
45 -- Replace /*$wgDBTableOptions*/ with the correct options
56
67 -- Add page tracking table for flagged revisions
7 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpages (
 8+CREATE TABLE IF NOT EXISTS /*_*/flaggedpages (
89 -- Foreign key to page.page_id
910 fp_page_id integer unsigned NOT NULL,
1011 -- Is the stable version synced?
@@ -24,7 +24,7 @@
2525 CREATE INDEX /*i*/fp_pending_since ON /*_*/flaggedpages (fp_pending_since);
2626
2727 -- Add tracking table for edits needing review (for all levels)
28 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpage_pending (
 28+CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_pending (
2929 -- Foreign key to page.page_id
3030 fpp_page_id integer unsigned NOT NULL,
3131 -- The quality tier (0=stable, 1=quality, 2=pristine)
@@ -40,7 +40,7 @@
4141
4242 -- This stores all of our revision reviews; it is the main table
4343 -- The template/file version data is stored in the next two tables
44 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs (
 44+CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs (
4545 -- Foreign key to page.page_id
4646 fr_page_id integer unsigned NOT NULL,
4747 -- Foreign key to revision.rev_id
@@ -76,7 +76,7 @@
7777 CREATE INDEX /*i*/page_qal_rev ON /*_*/flaggedrevs (fr_page_id,fr_quality,fr_rev_id);
7878
7979 -- This stores all of our transclusion revision pointers
80 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedtemplates (
 80+CREATE TABLE IF NOT EXISTS /*_*/flaggedtemplates (
8181 ft_rev_id integer unsigned NOT NULL,
8282 -- Namespace and title of included page
8383 ft_namespace int NOT NULL default '0',
@@ -88,7 +88,7 @@
8989 CREATE UNIQUE INDEX /*i*/ft_rev_namespace_title ON /*_*/flaggedtemplates (ft_rev_id,ft_namespace,ft_title);
9090
9191 -- This stores all of our image revision pointers
92 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedimages (
 92+CREATE TABLE IF NOT EXISTS /*_*/flaggedimages (
9393 fi_rev_id integer unsigned NOT NULL,
9494 -- Name of included image
9595 fi_name varchar(255) binary NOT NULL default '',
@@ -101,7 +101,7 @@
102102 CREATE UNIQUE INDEX /*i*/fi_rev_name ON /*_*/flaggedimages (fi_rev_id,fi_name);
103103
104104 -- This stores settings on how to select the stable/default revision
105 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpage_config (
 105+CREATE TABLE IF NOT EXISTS /*_*/flaggedpage_config (
106106 -- Foreign key to page.page_id
107107 fpc_page_id integer unsigned NOT NULL,
108108 -- Integers to represent what to show by default:
@@ -121,7 +121,7 @@
122122 CREATE INDEX /*i*/fpc_expiry ON /*_*/flaggedpage_config (fpc_expiry);
123123
124124 -- Track includes/links only in stable versions
125 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs_tracking (
 125+CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_tracking (
126126 ftr_from integer unsigned NOT NULL default '0',
127127 ftr_namespace int NOT NULL default '0',
128128 ftr_title varchar(255) binary NOT NULL default ''
@@ -131,7 +131,7 @@
132132 CREATE INDEX /*i*/namespace_title_from ON /*_*/flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from);
133133
134134 -- This stores user demotions and stats
135 -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs_promote (
 135+CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_promote (
136136 -- Foreign key to user.user_id
137137 frp_user_id integer unsigned NOT NULL,
138138 frp_user_params mediumblob NOT NULL
Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
@@ -24,9 +24,10 @@
2525 }
2626
2727 protected function showList( $wgRequest ) {
28 - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces;
29 - # If no NS given, then just use the first of $wgFlaggedRevsNamespaces
30 - $defaultNS = empty($wgFlaggedRevsNamespaces) ? 0 : $wgFlaggedRevsNamespaces[0];
 28+ global $wgOut, $wgScript;
 29+ $namespaces = FlaggedRevs::getReviewNamespaces();
 30+ $defaultNS = !$namespaces ? NS_MAIN : $namespaces[0];
 31+
3132 $namespace = $wgRequest->getIntOrNull( 'namespace', $defaultNS );
3233 $category = trim( $wgRequest->getVal( 'category' ) );
3334 $catTitle = Title::makeTitleSafe( NS_CATEGORY, $category );
@@ -47,7 +48,7 @@
4849 '<fieldset><legend>' . wfMsg('unreviewed-legend') . '</legend>' .
4950 Xml::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . '<p>' );
5051 # Add dropdowns as needed
51 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
 52+ if( count($namespaces) > 1 ) {
5253 $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $namespace ) . '&nbsp;' );
5354 }
5455 if( FlaggedRevs::qualityVersions() ) {
@@ -188,16 +189,17 @@
189190 * There may be many pages, most of which are reviewed
190191 */
191192 public static function generalQueryOK() {
192 - global $wgFlaggedRevsNamespaces;
193 - if( !wfQueriesMustScale() ) {
 193+ $namespaces = FlaggedRevs::getReviewNamespaces();
 194+ if( !$namespaces || !wfQueriesMustScale() ) {
194195 return true;
195196 }
196197 # Get est. of fraction of pages that are reviewed
197198 $dbr = wfGetDB( DB_SLAVE );
198199 $reviewedpages = $dbr->estimateRowCount( 'flaggedpages', '*', array(), __METHOD__ );
199200 $pages = $dbr->estimateRowCount( 'page', '*',
200 - array('page_namespace' => $wgFlaggedRevsNamespaces),
201 - __METHOD__ );
 201+ array('page_namespace' => $namespaces),
 202+ __METHOD__
 203+ );
202204 $ratio = $pages/($pages - $reviewedpages);
203205 # If dist. is equal, # of rows scanned = $ratio * LIMIT (or until list runs out)
204206 return ($ratio <= 400);
@@ -215,12 +217,13 @@
216218 $this->mForm = $form;
217219 $this->live = (bool)$live;
218220 # Must be a content page...
219 - global $wgFlaggedRevsNamespaces;
 221+
220222 if( !is_null($namespace) ) {
221223 $namespace = intval($namespace);
222224 }
223 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
224 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 225+ $vnamespaces = FlaggedRevs::getReviewNamespaces();
 226+ if( is_null($namespace) || !in_array($namespace,$vnamespaces) ) {
 227+ $namespace = !$vnamespaces ? -1 : $vnamespaces[0];
225228 }
226229 $this->namespace = $namespace;
227230 $this->category = $category ? str_replace(' ','_',$category) : NULL;
Index: trunk/extensions/FlaggedRevs/specialpages/UnstablePages_body.php
@@ -25,10 +25,12 @@
2626 }
2727
2828 protected function showForm() {
29 - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces;
 29+ global $wgOut, $wgScript;
 30+ $namespaces = FlaggedRevs::getReviewNamespaces();
3031 $wgOut->addHTML( wfMsgExt('unstablepages-text', array('parseinline') ) );
31 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
32 - $form = Xml::openElement( 'form', array( 'name' => 'unstablepages', 'action' => $wgScript, 'method' => 'get' ) );
 32+ if( count($namespaces) > 1 ) {
 33+ $form = Xml::openElement( 'form', array( 'name' => 'unstablepages',
 34+ 'action' => $wgScript, 'method' => 'get' ) );
3335 $form .= "<fieldset><legend>".wfMsg('unstablepages')."</legend>\n";
3436 $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
3537 $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
@@ -88,12 +90,12 @@
8991 $this->mForm = $form;
9092 $this->mConds = $conds;
9193 # Must be a content page...
92 - global $wgFlaggedRevsNamespaces;
9394 if( !is_null($namespace) ) {
9495 $namespace = intval($namespace);
9596 }
96 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
97 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 97+ $vnamespaces = FlaggedRevs::getReviewNamespaces();
 98+ if( is_null($namespace) || !in_array($namespace,$vnamespaces) ) {
 99+ $namespace = !$vnamespaces ? -1 : $vnamespaces[0];
98100 }
99101 $this->namespace = $namespace;
100102 parent::__construct();
Index: trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php
@@ -13,7 +13,7 @@
1414 }
1515
1616 public function execute( $par ) {
17 - global $wgOut, $wgUser, $wgRequest, $wgFlaggedRevsNamespaces, $wgFlaggedRevsOversightAge;
 17+ global $wgOut, $wgUser, $wgRequest, $wgFlaggedRevsOversightAge;
1818
1919 $this->setHeaders();
2020 $wgOut->addHTML( wfMsgExt('qualityoversight-list', array('parse') ) );
Index: trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php
@@ -92,11 +92,10 @@
9393 }
9494
9595 function getQueryInfo() {
96 - global $wgFlaggedRevsNamespaces;
97 -
9896 $conds = $this->mConds;
9997 # Must be in a reviewable namespace
100 - if( !in_array($this->namespace, $wgFlaggedRevsNamespaces) ) {
 98+ $namespaces = FlaggedRevs::getReviewNamespaces();
 99+ if( !in_array($this->namespace, $namespaces) ) {
101100 $conds[] = "1 = 0";
102101 }
103102 $conds["fr_page_id"] = $this->pageID;
Index: trunk/extensions/FlaggedRevs/specialpages/ValidationStatistics_body.php
@@ -75,8 +75,8 @@
7676 }
7777 $wgOut->addHTML( "</tr>\n" );
7878
79 - global $wgFlaggedRevsNamespaces;
80 - foreach( $wgFlaggedRevsNamespaces as $namespace ) {
 79+ $namespaces = FlaggedRevs::getReviewNamespaces();
 80+ foreach( $namespaces as $namespace ) {
8181 $row = $this->db->selectRow( 'flaggedrevs_stats', '*', array('namespace' => $namespace) );
8282 $NsText = $wgContLang->getFormattedNsText( $row->namespace );
8383 $NsText = $NsText ? $NsText : wfMsgHTML('blanknamespace');
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -45,7 +45,9 @@
4646 }
4747
4848 public function showList( $par ) {
49 - global $wgOut, $wgScript, $wgUser, $wgFlaggedRevsNamespaces;
 49+ global $wgOut, $wgScript, $wgUser;
 50+ $namespaces = FlaggedRevs::getReviewNamespaces();
 51+
5052 $limit = $this->parseParams( $par );
5153 $pager = new OldReviewedPagesPager( $this, $this->namespace, $this->level,
5254 $this->category, $this->size, $this->watched, $this->stable );
@@ -60,7 +62,7 @@
6163 Xml::hidden( 'title', $this->getTitle()->getPrefixedDBKey() )
6264 );
6365 $form =
64 - ( count($wgFlaggedRevsNamespaces) > 1 ?
 66+ ( count($namespaces) > 1 ?
6567 "<span style='white-space: nowrap;'>" .
6668 FlaggedRevsXML::getNamespaceMenu( $this->namespace, '' ) . '</span> '
6769 : ""
@@ -291,15 +293,15 @@
292294 ) {
293295 $this->mForm = $form;
294296 # Must be a content page...
295 - global $wgFlaggedRevsNamespaces;
 297+ $vnamespaces = FlaggedRevs::getReviewNamespaces();
296298 if( is_null($namespace) ) {
297 - $namespace = $wgFlaggedRevsNamespaces;
 299+ $namespace = $vnamespaces;
298300 } else {
299301 $namespace = intval($namespace);
300302 }
301303 # Sanity check
302 - if( !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
303 - $namespace = $wgFlaggedRevsNamespaces;
 304+ if( !in_array($namespace,$vnamespaces) ) {
 305+ $namespace = $vnamespaces;
304306 }
305307 $this->namespace = $namespace;
306308 # Sanity check level: 0 = sighted; 1 = quality; 2 = pristine
Index: trunk/extensions/FlaggedRevs/specialpages/ProblemChanges_body.php
@@ -43,7 +43,7 @@
4444 }
4545
4646 public function showList( $par ) {
47 - global $wgOut, $wgScript, $wgUser, $wgFlaggedRevsNamespaces;
 47+ global $wgOut, $wgScript, $wgUser;
4848 $limit = $this->parseParams( $par );
4949 $pager = new ProblemChangesPager( $this, $this->level, $this->category, $this->tag );
5050 // Apply limit if transcluded
@@ -267,8 +267,7 @@
268268 {
269269 $this->mForm = $form;
270270 # Must be a content page...
271 - global $wgFlaggedRevsNamespaces;
272 - $this->namespace = $wgFlaggedRevsNamespaces;
 271+ $this->namespace = FlaggedRevs::getReviewNamespaces();
273272 # Sanity check level: 0 = sighted; 1 = quality; 2 = pristine
274273 $this->level = ($level >= 0 && $level <= 2) ? $level : -1;
275274 $this->tag = $tag;
Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
@@ -30,7 +30,7 @@
3131 }
3232
3333 public function showForm() {
34 - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces;
 34+ global $wgOut, $wgScript;
3535
3636 $form = Xml::openElement( 'form',
3737 array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) );
@@ -44,7 +44,8 @@
4545 );
4646 $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link );
4747
48 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
 48+ $namespaces = FlaggedRevs::getReviewNamespaces();
 49+ if( count($namespaces) > 1 ) {
4950 $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' ';
5051 }
5152 $form .= FlaggedRevsXML::getLevelMenu( $this->type ) . ' ';
@@ -108,12 +109,12 @@
109110 $this->mConds = $conds;
110111 $this->type = $type;
111112 # Must be a content page...
112 - global $wgFlaggedRevsNamespaces;
113113 if( !is_null($namespace) ) {
114114 $namespace = intval($namespace);
115115 }
116 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
117 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 116+ $vnamespaces = FlaggedRevs::getReviewNamespaces();
 117+ if( is_null($namespace) || !in_array($namespace,$vnamespaces) ) {
 118+ $namespace = !$vnamespaces ? -1 : $vnamespaces[0];
118119 }
119120 $this->namespace = $namespace;
120121 $this->hideRedirs = $hideRedirs;
Index: trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php
@@ -26,9 +26,10 @@
2727 }
2828
2929 protected function showForm() {
30 - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces;
 30+ global $wgOut, $wgScript;
3131 $wgOut->addHTML( wfMsgExt('stablepages-text', array('parseinline') ) );
32 - if( count($wgFlaggedRevsNamespaces) > 1 ) {
 32+ $namespaces = FlaggedRevs::getReviewNamespaces();
 33+ if( count($namespaces) > 1 ) {
3334 $form = Xml::openElement( 'form', array( 'name' => 'stablepages', 'action' => $wgScript, 'method' => 'get' ) );
3435 $form .= "<fieldset><legend>".wfMsg('stablepages')."</legend>\n";
3536 $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
@@ -104,12 +105,12 @@
105106 $this->mForm = $form;
106107 $this->mConds = $conds;
107108 # Must be a content page...
108 - global $wgFlaggedRevsNamespaces;
109109 if( !is_null($namespace) ) {
110110 $namespace = intval($namespace);
111111 }
112 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
113 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 112+ $vnamespaces = FlaggedRevs::getReviewNamespaces();
 113+ if( is_null($namespace) || !in_array($namespace,$vnamespaces) ) {
 114+ $namespace = !$vnamespaces ? -1 : $vnamespaces[0];
114115 }
115116 $this->namespace = $namespace;
116117 $this->precedence = $precedence;
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -8,7 +8,8 @@
99 * @returns string
1010 */
1111 public static function getNamespaceMenu( $selected=null, $all=null ) {
12 - global $wgContLang, $wgFlaggedRevsNamespaces;
 12+ global $wgContLang;
 13+ $namespaces = FlaggedRevs::getReviewNamespaces();
1314 $s = "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>";
1415 if( $selected !== '' ) {
1516 if( is_null( $selected ) ) {
@@ -26,7 +27,7 @@
2728 }
2829 foreach( $arr as $index => $name ) {
2930 # Content pages only (except 'all')
30 - if( $index !== $all && !in_array($index, $wgFlaggedRevsNamespaces) ) {
 31+ if( $index !== $all && !in_array($index, $namespaces) ) {
3132 continue;
3233 }
3334 $name = $index !== 0 ? $name : wfMsg('blanknamespace');
@@ -225,7 +226,8 @@
226227 } else {
227228 $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic';
228229 }
229 - # uses messages 'revreview-quality-i', 'revreview-basic-i', 'revreview-newest-quality-i', 'revreview-newest-basic-i'
 230+ # For searching: uses messages 'revreview-quality-i', 'revreview-basic-i',
 231+ # 'revreview-newest-quality-i', 'revreview-newest-basic-i'
230232 $msg .= ($revsSince == 0) ? '-i' : '';
231233 $html = wfMsgExt($msg, array('parseinline'), $frev->getRevId(), $time, $revsSince );
232234 }
@@ -290,28 +292,32 @@
291293 # If the sum of qualities of all flags is above 6, use drop down boxes
292294 # 6 is an arbitrary value choosen according to screen space and usability
293295 if( $size > 6 ) {
294 - $attribs = array( 'name' => "wp$quality", 'id' => "wp$quality", 'onchange' => "updateRatingForm()" ) + $toggle;
 296+ $attribs = array( 'name' => "wp$quality", 'id' => "wp$quality",
 297+ 'onchange' => "updateRatingForm()" ) + $toggle;
295298 $form .= Xml::openElement( 'select', $attribs );
296299 foreach( $label as $i => $name ) {
297300 $optionClass = array( 'class' => "fr-rating-option-$i" );
298 - $form .= Xml::option( FlaggedRevs::getTagMsg($name), $i, ($i == $selected), $optionClass )."\n";
 301+ $form .= Xml::option( FlaggedRevs::getTagMsg($name), $i, ($i == $selected),
 302+ $optionClass )."\n";
299303 }
300304 $form .= Xml::closeElement('select')."\n";
301305 # If there are more than two levels, current user gets radio buttons
302306 } elseif( $numLevels > 2 ) {
303307 foreach( $label as $i => $name ) {
304 - $attribs = array( 'class' => "fr-rating-option-$i", 'onchange' => "updateRatingForm()" );
305 - $form .= Xml::radioLabel( FlaggedRevs::getTagMsg($name), "wp$quality", $i, "wp$quality".$i,
306 - ($i == $selected), $attribs ) . "\n";
 308+ $attribs = array( 'class' => "fr-rating-option-$i",
 309+ 'onchange' => "updateRatingForm()" );
 310+ $form .= Xml::radioLabel( FlaggedRevs::getTagMsg($name), "wp$quality", $i,
 311+ "wp$quality".$i, ($i == $selected), $attribs ) . "\n";
307312 }
308313 # Otherwise make checkboxes (two levels available for current user)
309314 } else {
310315 # If disable, use the current flags; if none, then use the min flag.
311316 $i = $disabled ? $selected : $minLevel;
312 - $attribs = array( 'class' => "fr-rating-option-$i", 'onchange' => "updateRatingForm()" );
 317+ $attribs = array( 'class' => "fr-rating-option-$i",
 318+ 'onchange' => "updateRatingForm()" );
313319 $attribs = $attribs + $toggle + array('value' => $minLevel);
314 - $form .= Xml::checkLabel( wfMsg( "revreview-{$label[$i]}" ), "wp$quality", "wp$quality",
315 - ($selected == $i), $attribs ) . "\n";
 320+ $form .= Xml::checkLabel( wfMsg( "revreview-{$label[$i]}" ), "wp$quality",
 321+ "wp$quality", ($selected == $i), $attribs ) . "\n";
316322 }
317323 $form .= Xml::closeElement( 'span' );
318324 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1704,8 +1704,8 @@
17051705 }
17061706
17071707 public static function addToContribsLine( $contribs, &$ret, $row ) {
1708 - global $wgFlaggedRevsNamespaces;
1709 - if( !in_array($row->page_namespace,$wgFlaggedRevsNamespaces) ) {
 1708+ $namespaces = FlaggedRevs::getReviewNamespaces();
 1709+ if( !in_array($row->page_namespace,$namespaces) ) {
17101710 // do nothing
17111711 } elseif( isset($row->fr_quality) ) {
17121712 $ret = '<span class="'.FlaggedRevsXML::getQualityColor($row->fr_quality).'">'.$ret.'</span>';
@@ -1791,16 +1791,16 @@
17921792 }
17931793
17941794 public static function addBacklogNotice( &$notice ) {
1795 - global $wgUser, $wgTitle, $wgFlaggedRevsNamespaces;
 1795+ global $wgUser, $wgTitle;
 1796+ $namespaces = FlaggedRevs::getReviewNamespaces();
 1797+ if ( !count($namespaces) ) {
 1798+ return true; // nothing to have a backlog on
 1799+ }
17961800 if( empty($wgTitle) || $wgTitle->getNamespace() !== NS_SPECIAL ) {
17971801 return true; // nothing to do here
17981802 }
17991803 if( !$wgUser->isAllowed('review') )
18001804 return true; // not relevant to user
1801 - if ( !count($wgFlaggedRevsNamespaces) ) {
1802 - return true; // No FlaggedRevs namespaces, it crashes here and
1803 - // I don't know the correct fix -- Andrew.
1804 - }
18051805
18061806 $watchlist = SpecialPage::getTitleFor( 'Watchlist' );
18071807 $recentchanges = SpecialPage::getTitleFor( 'Recentchanges' );
@@ -1809,7 +1809,7 @@
18101810 $watchedOutdated = $dbr->selectField(
18111811 array('watchlist','page','flaggedpages'), '1',
18121812 array( 'wl_user' => $wgUser->getId(), // this user
1813 - 'wl_namespace' => $wgFlaggedRevsNamespaces, // reviewable
 1813+ 'wl_namespace' => $namespaces, // reviewable
18141814 'wl_namespace = page_namespace',
18151815 'wl_title = page_title',
18161816 'fp_page_id = page_id',
@@ -1824,11 +1824,11 @@
18251825 # Otherwise, give a notice if there is a large backlog in general
18261826 } else {
18271827 $pages = $dbr->estimateRowCount( 'page', '*',
1828 - array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ );
 1828+ array('page_namespace' => $namespaces), __METHOD__ );
18291829 # For small wikis, just get the real numbers to avoid some bogus messages
18301830 if( $pages < 50 ) {
18311831 $pages = $dbr->selectField( 'page', 'COUNT(*)',
1832 - array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ );
 1832+ array('page_namespace' => $namespaces), __METHOD__ );
18331833 $unreviewed = $dbr->selectField( 'flaggedpages', 'COUNT(*)',
18341834 'fp_pending_since IS NOT NULL', __METHOD__ );
18351835 } else {
@@ -1846,12 +1846,12 @@
18471847 }
18481848
18491849 public static function stableDumpQuery( &$tables, &$opts, &$join ) {
1850 - global $wgFlaggedRevsNamespaces;
 1850+ $namespaces = FlaggedRevs::getReviewNamespaces();
18511851 $tables = array('flaggedpages','page','revision');
18521852 $opts['ORDER BY'] = 'fp_page_id ASC';
18531853 $opts['USE INDEX'] = array( 'flaggedpages' => 'PRIMARY' );
18541854 $join['page'] = array( 'INNER JOIN',
1855 - array('page_id = fp_page_id','page_namespace' => $wgFlaggedRevsNamespaces)
 1855+ array('page_id = fp_page_id','page_namespace' => $namespaces)
18561856 );
18571857 $join['revision'] = array('INNER JOIN','rev_page = fp_page_id AND rev_id = fp_stable');
18581858 return false; // final
Index: trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php
@@ -143,7 +143,7 @@
144144 }
145145
146146 public function getAllowedParams() {
147 - global $wgFlaggedRevsNamespaces;
 147+ $namespaces = FlaggedRevs::getReviewNamespaces();
148148 return array (
149149 'start' => array (
150150 ApiBase::PARAM_TYPE => 'timestamp'
@@ -165,9 +165,8 @@
166166 ApiBase::PARAM_TYPE => array( 'watched', 'all' )
167167 ),
168168 'namespace' => array (
169 - ApiBase::PARAM_DFLT =>
170 - !$wgFlaggedRevsNamespaces ?
171 - NS_MAIN : $wgFlaggedRevsNamespaces[0],
 169+ ApiBase::PARAM_DFLT => !$namespaces ?
 170+ NS_MAIN : $namespaces[0],
172171 ApiBase::PARAM_TYPE => 'namespace',
173172 ApiBase::PARAM_ISMULTI => true,
174173 ),
Index: trunk/extensions/FlaggedRevs/api/ApiQueryReviewedpages.php
@@ -120,7 +120,7 @@
121121 }
122122
123123 public function getAllowedParams() {
124 - global $wgFlaggedRevsNamespaces;
 124+ $namespaces = FlaggedRevs::getReviewNamespaces();
125125 return array (
126126 'start' => array (
127127 ApiBase::PARAM_TYPE => 'integer'
@@ -136,10 +136,8 @@
137137 )
138138 ),
139139 'namespace' => array (
140 - ApiBase::PARAM_DFLT =>
141 - !$wgFlaggedRevsNamespaces ?
142 - NS_MAIN :
143 - $wgFlaggedRevsNamespaces[0],
 140+ ApiBase::PARAM_DFLT => !$namespaces ?
 141+ NS_MAIN : $namespaces[0],
144142 ApiBase::PARAM_TYPE => 'namespace',
145143 ApiBase::PARAM_ISMULTI => true,
146144 ),
Index: trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php
@@ -115,7 +115,7 @@
116116 }
117117
118118 public function getAllowedParams() {
119 - global $wgFlaggedRevsNamespaces;
 119+ $namespaces = FlaggedRevs::getReviewNamespaces();
120120 return array (
121121 'start' => array (
122122 ApiBase::PARAM_TYPE => 'sring'
@@ -124,10 +124,8 @@
125125 ApiBase::PARAM_TYPE => 'string'
126126 ),
127127 'namespace' => array (
128 - ApiBase::PARAM_DFLT =>
129 - !$wgFlaggedRevsNamespaces ?
130 - NS_MAIN :
131 - $wgFlaggedRevsNamespaces[0],
 128+ ApiBase::PARAM_DFLT => !$namespaces ?
 129+ NS_MAIN : $namespaces[0],
132130 ApiBase::PARAM_TYPE => 'namespace',
133131 ApiBase::PARAM_ISMULTI => true,
134132 ),

Status & tagging log