Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql |
— | — | @@ -1,10 +1,10 @@ |
2 | 2 | -- (c) Aaron Schulz, 2007-2009, GPL |
3 | 3 | -- Table structure for table `Flagged Revisions` |
| 4 | +-- Replace /*_*/ with the proper prefix |
4 | 5 | -- Replace /*$wgDBTableOptions*/ with the correct options |
5 | 6 | |
6 | 7 | -- Add page tracking table for flagged revisions |
7 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedpages ( |
| 8 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedpages ( |
8 | 9 | -- Foreign key to page.page_id |
9 | 10 | fp_page_id integer unsigned NOT NULL, |
10 | 11 | -- Is the stable version synced? |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | CREATE INDEX /*i*/fp_pending_since ON /*_*/flaggedpages (fp_pending_since); |
26 | 26 | |
27 | 27 | -- 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 ( |
29 | 29 | -- Foreign key to page.page_id |
30 | 30 | fpp_page_id integer unsigned NOT NULL, |
31 | 31 | -- The quality tier (0=stable, 1=quality, 2=pristine) |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | |
42 | 42 | -- This stores all of our revision reviews; it is the main table |
43 | 43 | -- 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 ( |
45 | 45 | -- Foreign key to page.page_id |
46 | 46 | fr_page_id integer unsigned NOT NULL, |
47 | 47 | -- Foreign key to revision.rev_id |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | CREATE INDEX /*i*/page_qal_rev ON /*_*/flaggedrevs (fr_page_id,fr_quality,fr_rev_id); |
78 | 78 | |
79 | 79 | -- This stores all of our transclusion revision pointers |
80 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedtemplates ( |
| 80 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedtemplates ( |
81 | 81 | ft_rev_id integer unsigned NOT NULL, |
82 | 82 | -- Namespace and title of included page |
83 | 83 | ft_namespace int NOT NULL default '0', |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | CREATE UNIQUE INDEX /*i*/ft_rev_namespace_title ON /*_*/flaggedtemplates (ft_rev_id,ft_namespace,ft_title); |
90 | 90 | |
91 | 91 | -- This stores all of our image revision pointers |
92 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedimages ( |
| 92 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedimages ( |
93 | 93 | fi_rev_id integer unsigned NOT NULL, |
94 | 94 | -- Name of included image |
95 | 95 | fi_name varchar(255) binary NOT NULL default '', |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | CREATE UNIQUE INDEX /*i*/fi_rev_name ON /*_*/flaggedimages (fi_rev_id,fi_name); |
103 | 103 | |
104 | 104 | -- 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 ( |
106 | 106 | -- Foreign key to page.page_id |
107 | 107 | fpc_page_id integer unsigned NOT NULL, |
108 | 108 | -- Integers to represent what to show by default: |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | CREATE INDEX /*i*/fpc_expiry ON /*_*/flaggedpage_config (fpc_expiry); |
123 | 123 | |
124 | 124 | -- Track includes/links only in stable versions |
125 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs_tracking ( |
| 125 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_tracking ( |
126 | 126 | ftr_from integer unsigned NOT NULL default '0', |
127 | 127 | ftr_namespace int NOT NULL default '0', |
128 | 128 | ftr_title varchar(255) binary NOT NULL default '' |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | CREATE INDEX /*i*/namespace_title_from ON /*_*/flaggedrevs_tracking (ftr_namespace,ftr_title,ftr_from); |
133 | 133 | |
134 | 134 | -- This stores user demotions and stats |
135 | | -CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/flaggedrevs_promote ( |
| 135 | +CREATE TABLE IF NOT EXISTS /*_*/flaggedrevs_promote ( |
136 | 136 | -- Foreign key to user.user_id |
137 | 137 | frp_user_id integer unsigned NOT NULL, |
138 | 138 | frp_user_params mediumblob NOT NULL |
Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php |
— | — | @@ -24,9 +24,10 @@ |
25 | 25 | } |
26 | 26 | |
27 | 27 | 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 | + |
31 | 32 | $namespace = $wgRequest->getIntOrNull( 'namespace', $defaultNS ); |
32 | 33 | $category = trim( $wgRequest->getVal( 'category' ) ); |
33 | 34 | $catTitle = Title::makeTitleSafe( NS_CATEGORY, $category ); |
— | — | @@ -47,7 +48,7 @@ |
48 | 49 | '<fieldset><legend>' . wfMsg('unreviewed-legend') . '</legend>' . |
49 | 50 | Xml::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) . '<p>' ); |
50 | 51 | # Add dropdowns as needed |
51 | | - if( count($wgFlaggedRevsNamespaces) > 1 ) { |
| 52 | + if( count($namespaces) > 1 ) { |
52 | 53 | $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $namespace ) . ' ' ); |
53 | 54 | } |
54 | 55 | if( FlaggedRevs::qualityVersions() ) { |
— | — | @@ -188,16 +189,17 @@ |
189 | 190 | * There may be many pages, most of which are reviewed |
190 | 191 | */ |
191 | 192 | public static function generalQueryOK() { |
192 | | - global $wgFlaggedRevsNamespaces; |
193 | | - if( !wfQueriesMustScale() ) { |
| 193 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
| 194 | + if( !$namespaces || !wfQueriesMustScale() ) { |
194 | 195 | return true; |
195 | 196 | } |
196 | 197 | # Get est. of fraction of pages that are reviewed |
197 | 198 | $dbr = wfGetDB( DB_SLAVE ); |
198 | 199 | $reviewedpages = $dbr->estimateRowCount( 'flaggedpages', '*', array(), __METHOD__ ); |
199 | 200 | $pages = $dbr->estimateRowCount( 'page', '*', |
200 | | - array('page_namespace' => $wgFlaggedRevsNamespaces), |
201 | | - __METHOD__ ); |
| 201 | + array('page_namespace' => $namespaces), |
| 202 | + __METHOD__ |
| 203 | + ); |
202 | 204 | $ratio = $pages/($pages - $reviewedpages); |
203 | 205 | # If dist. is equal, # of rows scanned = $ratio * LIMIT (or until list runs out) |
204 | 206 | return ($ratio <= 400); |
— | — | @@ -215,12 +217,13 @@ |
216 | 218 | $this->mForm = $form; |
217 | 219 | $this->live = (bool)$live; |
218 | 220 | # Must be a content page... |
219 | | - global $wgFlaggedRevsNamespaces; |
| 221 | + |
220 | 222 | if( !is_null($namespace) ) { |
221 | 223 | $namespace = intval($namespace); |
222 | 224 | } |
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]; |
225 | 228 | } |
226 | 229 | $this->namespace = $namespace; |
227 | 230 | $this->category = $category ? str_replace(' ','_',$category) : NULL; |
Index: trunk/extensions/FlaggedRevs/specialpages/UnstablePages_body.php |
— | — | @@ -25,10 +25,12 @@ |
26 | 26 | } |
27 | 27 | |
28 | 28 | protected function showForm() { |
29 | | - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces; |
| 29 | + global $wgOut, $wgScript; |
| 30 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
30 | 31 | $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' ) ); |
33 | 35 | $form .= "<fieldset><legend>".wfMsg('unstablepages')."</legend>\n"; |
34 | 36 | $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' '; |
35 | 37 | $form .= " ".Xml::submitButton( wfMsg( 'go' ) ); |
— | — | @@ -88,12 +90,12 @@ |
89 | 91 | $this->mForm = $form; |
90 | 92 | $this->mConds = $conds; |
91 | 93 | # Must be a content page... |
92 | | - global $wgFlaggedRevsNamespaces; |
93 | 94 | if( !is_null($namespace) ) { |
94 | 95 | $namespace = intval($namespace); |
95 | 96 | } |
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]; |
98 | 100 | } |
99 | 101 | $this->namespace = $namespace; |
100 | 102 | parent::__construct(); |
Index: trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function execute( $par ) { |
17 | | - global $wgOut, $wgUser, $wgRequest, $wgFlaggedRevsNamespaces, $wgFlaggedRevsOversightAge; |
| 17 | + global $wgOut, $wgUser, $wgRequest, $wgFlaggedRevsOversightAge; |
18 | 18 | |
19 | 19 | $this->setHeaders(); |
20 | 20 | $wgOut->addHTML( wfMsgExt('qualityoversight-list', array('parse') ) ); |
Index: trunk/extensions/FlaggedRevs/specialpages/StableVersions_body.php |
— | — | @@ -92,11 +92,10 @@ |
93 | 93 | } |
94 | 94 | |
95 | 95 | function getQueryInfo() { |
96 | | - global $wgFlaggedRevsNamespaces; |
97 | | - |
98 | 96 | $conds = $this->mConds; |
99 | 97 | # Must be in a reviewable namespace |
100 | | - if( !in_array($this->namespace, $wgFlaggedRevsNamespaces) ) { |
| 98 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
| 99 | + if( !in_array($this->namespace, $namespaces) ) { |
101 | 100 | $conds[] = "1 = 0"; |
102 | 101 | } |
103 | 102 | $conds["fr_page_id"] = $this->pageID; |
Index: trunk/extensions/FlaggedRevs/specialpages/ValidationStatistics_body.php |
— | — | @@ -75,8 +75,8 @@ |
76 | 76 | } |
77 | 77 | $wgOut->addHTML( "</tr>\n" ); |
78 | 78 | |
79 | | - global $wgFlaggedRevsNamespaces; |
80 | | - foreach( $wgFlaggedRevsNamespaces as $namespace ) { |
| 79 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
| 80 | + foreach( $namespaces as $namespace ) { |
81 | 81 | $row = $this->db->selectRow( 'flaggedrevs_stats', '*', array('namespace' => $namespace) ); |
82 | 82 | $NsText = $wgContLang->getFormattedNsText( $row->namespace ); |
83 | 83 | $NsText = $NsText ? $NsText : wfMsgHTML('blanknamespace'); |
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php |
— | — | @@ -45,7 +45,9 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | public function showList( $par ) { |
49 | | - global $wgOut, $wgScript, $wgUser, $wgFlaggedRevsNamespaces; |
| 49 | + global $wgOut, $wgScript, $wgUser; |
| 50 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
| 51 | + |
50 | 52 | $limit = $this->parseParams( $par ); |
51 | 53 | $pager = new OldReviewedPagesPager( $this, $this->namespace, $this->level, |
52 | 54 | $this->category, $this->size, $this->watched, $this->stable ); |
— | — | @@ -60,7 +62,7 @@ |
61 | 63 | Xml::hidden( 'title', $this->getTitle()->getPrefixedDBKey() ) |
62 | 64 | ); |
63 | 65 | $form = |
64 | | - ( count($wgFlaggedRevsNamespaces) > 1 ? |
| 66 | + ( count($namespaces) > 1 ? |
65 | 67 | "<span style='white-space: nowrap;'>" . |
66 | 68 | FlaggedRevsXML::getNamespaceMenu( $this->namespace, '' ) . '</span> ' |
67 | 69 | : "" |
— | — | @@ -291,15 +293,15 @@ |
292 | 294 | ) { |
293 | 295 | $this->mForm = $form; |
294 | 296 | # Must be a content page... |
295 | | - global $wgFlaggedRevsNamespaces; |
| 297 | + $vnamespaces = FlaggedRevs::getReviewNamespaces(); |
296 | 298 | if( is_null($namespace) ) { |
297 | | - $namespace = $wgFlaggedRevsNamespaces; |
| 299 | + $namespace = $vnamespaces; |
298 | 300 | } else { |
299 | 301 | $namespace = intval($namespace); |
300 | 302 | } |
301 | 303 | # Sanity check |
302 | | - if( !in_array($namespace,$wgFlaggedRevsNamespaces) ) { |
303 | | - $namespace = $wgFlaggedRevsNamespaces; |
| 304 | + if( !in_array($namespace,$vnamespaces) ) { |
| 305 | + $namespace = $vnamespaces; |
304 | 306 | } |
305 | 307 | $this->namespace = $namespace; |
306 | 308 | # Sanity check level: 0 = sighted; 1 = quality; 2 = pristine |
Index: trunk/extensions/FlaggedRevs/specialpages/ProblemChanges_body.php |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | } |
45 | 45 | |
46 | 46 | public function showList( $par ) { |
47 | | - global $wgOut, $wgScript, $wgUser, $wgFlaggedRevsNamespaces; |
| 47 | + global $wgOut, $wgScript, $wgUser; |
48 | 48 | $limit = $this->parseParams( $par ); |
49 | 49 | $pager = new ProblemChangesPager( $this, $this->level, $this->category, $this->tag ); |
50 | 50 | // Apply limit if transcluded |
— | — | @@ -267,8 +267,7 @@ |
268 | 268 | { |
269 | 269 | $this->mForm = $form; |
270 | 270 | # Must be a content page... |
271 | | - global $wgFlaggedRevsNamespaces; |
272 | | - $this->namespace = $wgFlaggedRevsNamespaces; |
| 271 | + $this->namespace = FlaggedRevs::getReviewNamespaces(); |
273 | 272 | # Sanity check level: 0 = sighted; 1 = quality; 2 = pristine |
274 | 273 | $this->level = ($level >= 0 && $level <= 2) ? $level : -1; |
275 | 274 | $this->tag = $tag; |
Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function showForm() { |
34 | | - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces; |
| 34 | + global $wgOut, $wgScript; |
35 | 35 | |
36 | 36 | $form = Xml::openElement( 'form', |
37 | 37 | array( 'name' => 'reviewedpages', 'action' => $wgScript, 'method' => 'get' ) ); |
— | — | @@ -44,7 +44,8 @@ |
45 | 45 | ); |
46 | 46 | $showhideredirs = wfMsgHtml( 'whatlinkshere-hideredirs', $link ); |
47 | 47 | |
48 | | - if( count($wgFlaggedRevsNamespaces) > 1 ) { |
| 48 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
| 49 | + if( count($namespaces) > 1 ) { |
49 | 50 | $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' '; |
50 | 51 | } |
51 | 52 | $form .= FlaggedRevsXML::getLevelMenu( $this->type ) . ' '; |
— | — | @@ -108,12 +109,12 @@ |
109 | 110 | $this->mConds = $conds; |
110 | 111 | $this->type = $type; |
111 | 112 | # Must be a content page... |
112 | | - global $wgFlaggedRevsNamespaces; |
113 | 113 | if( !is_null($namespace) ) { |
114 | 114 | $namespace = intval($namespace); |
115 | 115 | } |
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]; |
118 | 119 | } |
119 | 120 | $this->namespace = $namespace; |
120 | 121 | $this->hideRedirs = $hideRedirs; |
Index: trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php |
— | — | @@ -26,9 +26,10 @@ |
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function showForm() { |
30 | | - global $wgOut, $wgScript, $wgFlaggedRevsNamespaces; |
| 30 | + global $wgOut, $wgScript; |
31 | 31 | $wgOut->addHTML( wfMsgExt('stablepages-text', array('parseinline') ) ); |
32 | | - if( count($wgFlaggedRevsNamespaces) > 1 ) { |
| 32 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
| 33 | + if( count($namespaces) > 1 ) { |
33 | 34 | $form = Xml::openElement( 'form', array( 'name' => 'stablepages', 'action' => $wgScript, 'method' => 'get' ) ); |
34 | 35 | $form .= "<fieldset><legend>".wfMsg('stablepages')."</legend>\n"; |
35 | 36 | $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' '; |
— | — | @@ -104,12 +105,12 @@ |
105 | 106 | $this->mForm = $form; |
106 | 107 | $this->mConds = $conds; |
107 | 108 | # Must be a content page... |
108 | | - global $wgFlaggedRevsNamespaces; |
109 | 109 | if( !is_null($namespace) ) { |
110 | 110 | $namespace = intval($namespace); |
111 | 111 | } |
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]; |
114 | 115 | } |
115 | 116 | $this->namespace = $namespace; |
116 | 117 | $this->precedence = $precedence; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php |
— | — | @@ -8,7 +8,8 @@ |
9 | 9 | * @returns string |
10 | 10 | */ |
11 | 11 | public static function getNamespaceMenu( $selected=null, $all=null ) { |
12 | | - global $wgContLang, $wgFlaggedRevsNamespaces; |
| 12 | + global $wgContLang; |
| 13 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
13 | 14 | $s = "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>"; |
14 | 15 | if( $selected !== '' ) { |
15 | 16 | if( is_null( $selected ) ) { |
— | — | @@ -26,7 +27,7 @@ |
27 | 28 | } |
28 | 29 | foreach( $arr as $index => $name ) { |
29 | 30 | # Content pages only (except 'all') |
30 | | - if( $index !== $all && !in_array($index, $wgFlaggedRevsNamespaces) ) { |
| 31 | + if( $index !== $all && !in_array($index, $namespaces) ) { |
31 | 32 | continue; |
32 | 33 | } |
33 | 34 | $name = $index !== 0 ? $name : wfMsg('blanknamespace'); |
— | — | @@ -225,7 +226,8 @@ |
226 | 227 | } else { |
227 | 228 | $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
228 | 229 | } |
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' |
230 | 232 | $msg .= ($revsSince == 0) ? '-i' : ''; |
231 | 233 | $html = wfMsgExt($msg, array('parseinline'), $frev->getRevId(), $time, $revsSince ); |
232 | 234 | } |
— | — | @@ -290,28 +292,32 @@ |
291 | 293 | # If the sum of qualities of all flags is above 6, use drop down boxes |
292 | 294 | # 6 is an arbitrary value choosen according to screen space and usability |
293 | 295 | 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; |
295 | 298 | $form .= Xml::openElement( 'select', $attribs ); |
296 | 299 | foreach( $label as $i => $name ) { |
297 | 300 | $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"; |
299 | 303 | } |
300 | 304 | $form .= Xml::closeElement('select')."\n"; |
301 | 305 | # If there are more than two levels, current user gets radio buttons |
302 | 306 | } elseif( $numLevels > 2 ) { |
303 | 307 | 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"; |
307 | 312 | } |
308 | 313 | # Otherwise make checkboxes (two levels available for current user) |
309 | 314 | } else { |
310 | 315 | # If disable, use the current flags; if none, then use the min flag. |
311 | 316 | $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()" ); |
313 | 319 | $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"; |
316 | 322 | } |
317 | 323 | $form .= Xml::closeElement( 'span' ); |
318 | 324 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1704,8 +1704,8 @@ |
1705 | 1705 | } |
1706 | 1706 | |
1707 | 1707 | 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) ) { |
1710 | 1710 | // do nothing |
1711 | 1711 | } elseif( isset($row->fr_quality) ) { |
1712 | 1712 | $ret = '<span class="'.FlaggedRevsXML::getQualityColor($row->fr_quality).'">'.$ret.'</span>'; |
— | — | @@ -1791,16 +1791,16 @@ |
1792 | 1792 | } |
1793 | 1793 | |
1794 | 1794 | 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 | + } |
1796 | 1800 | if( empty($wgTitle) || $wgTitle->getNamespace() !== NS_SPECIAL ) { |
1797 | 1801 | return true; // nothing to do here |
1798 | 1802 | } |
1799 | 1803 | if( !$wgUser->isAllowed('review') ) |
1800 | 1804 | 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 | | - } |
1805 | 1805 | |
1806 | 1806 | $watchlist = SpecialPage::getTitleFor( 'Watchlist' ); |
1807 | 1807 | $recentchanges = SpecialPage::getTitleFor( 'Recentchanges' ); |
— | — | @@ -1809,7 +1809,7 @@ |
1810 | 1810 | $watchedOutdated = $dbr->selectField( |
1811 | 1811 | array('watchlist','page','flaggedpages'), '1', |
1812 | 1812 | array( 'wl_user' => $wgUser->getId(), // this user |
1813 | | - 'wl_namespace' => $wgFlaggedRevsNamespaces, // reviewable |
| 1813 | + 'wl_namespace' => $namespaces, // reviewable |
1814 | 1814 | 'wl_namespace = page_namespace', |
1815 | 1815 | 'wl_title = page_title', |
1816 | 1816 | 'fp_page_id = page_id', |
— | — | @@ -1824,11 +1824,11 @@ |
1825 | 1825 | # Otherwise, give a notice if there is a large backlog in general |
1826 | 1826 | } else { |
1827 | 1827 | $pages = $dbr->estimateRowCount( 'page', '*', |
1828 | | - array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ ); |
| 1828 | + array('page_namespace' => $namespaces), __METHOD__ ); |
1829 | 1829 | # For small wikis, just get the real numbers to avoid some bogus messages |
1830 | 1830 | if( $pages < 50 ) { |
1831 | 1831 | $pages = $dbr->selectField( 'page', 'COUNT(*)', |
1832 | | - array('page_namespace' => $wgFlaggedRevsNamespaces), __METHOD__ ); |
| 1832 | + array('page_namespace' => $namespaces), __METHOD__ ); |
1833 | 1833 | $unreviewed = $dbr->selectField( 'flaggedpages', 'COUNT(*)', |
1834 | 1834 | 'fp_pending_since IS NOT NULL', __METHOD__ ); |
1835 | 1835 | } else { |
— | — | @@ -1846,12 +1846,12 @@ |
1847 | 1847 | } |
1848 | 1848 | |
1849 | 1849 | public static function stableDumpQuery( &$tables, &$opts, &$join ) { |
1850 | | - global $wgFlaggedRevsNamespaces; |
| 1850 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
1851 | 1851 | $tables = array('flaggedpages','page','revision'); |
1852 | 1852 | $opts['ORDER BY'] = 'fp_page_id ASC'; |
1853 | 1853 | $opts['USE INDEX'] = array( 'flaggedpages' => 'PRIMARY' ); |
1854 | 1854 | $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) |
1856 | 1856 | ); |
1857 | 1857 | $join['revision'] = array('INNER JOIN','rev_page = fp_page_id AND rev_id = fp_stable'); |
1858 | 1858 | return false; // final |
Index: trunk/extensions/FlaggedRevs/api/ApiQueryOldreviewedpages.php |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | } |
145 | 145 | |
146 | 146 | public function getAllowedParams() { |
147 | | - global $wgFlaggedRevsNamespaces; |
| 147 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
148 | 148 | return array ( |
149 | 149 | 'start' => array ( |
150 | 150 | ApiBase::PARAM_TYPE => 'timestamp' |
— | — | @@ -165,9 +165,8 @@ |
166 | 166 | ApiBase::PARAM_TYPE => array( 'watched', 'all' ) |
167 | 167 | ), |
168 | 168 | 'namespace' => array ( |
169 | | - ApiBase::PARAM_DFLT => |
170 | | - !$wgFlaggedRevsNamespaces ? |
171 | | - NS_MAIN : $wgFlaggedRevsNamespaces[0], |
| 169 | + ApiBase::PARAM_DFLT => !$namespaces ? |
| 170 | + NS_MAIN : $namespaces[0], |
172 | 171 | ApiBase::PARAM_TYPE => 'namespace', |
173 | 172 | ApiBase::PARAM_ISMULTI => true, |
174 | 173 | ), |
Index: trunk/extensions/FlaggedRevs/api/ApiQueryReviewedpages.php |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | } |
122 | 122 | |
123 | 123 | public function getAllowedParams() { |
124 | | - global $wgFlaggedRevsNamespaces; |
| 124 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
125 | 125 | return array ( |
126 | 126 | 'start' => array ( |
127 | 127 | ApiBase::PARAM_TYPE => 'integer' |
— | — | @@ -136,10 +136,8 @@ |
137 | 137 | ) |
138 | 138 | ), |
139 | 139 | 'namespace' => array ( |
140 | | - ApiBase::PARAM_DFLT => |
141 | | - !$wgFlaggedRevsNamespaces ? |
142 | | - NS_MAIN : |
143 | | - $wgFlaggedRevsNamespaces[0], |
| 140 | + ApiBase::PARAM_DFLT => !$namespaces ? |
| 141 | + NS_MAIN : $namespaces[0], |
144 | 142 | ApiBase::PARAM_TYPE => 'namespace', |
145 | 143 | ApiBase::PARAM_ISMULTI => true, |
146 | 144 | ), |
Index: trunk/extensions/FlaggedRevs/api/ApiQueryUnreviewedpages.php |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | } |
117 | 117 | |
118 | 118 | public function getAllowedParams() { |
119 | | - global $wgFlaggedRevsNamespaces; |
| 119 | + $namespaces = FlaggedRevs::getReviewNamespaces(); |
120 | 120 | return array ( |
121 | 121 | 'start' => array ( |
122 | 122 | ApiBase::PARAM_TYPE => 'sring' |
— | — | @@ -124,10 +124,8 @@ |
125 | 125 | ApiBase::PARAM_TYPE => 'string' |
126 | 126 | ), |
127 | 127 | 'namespace' => array ( |
128 | | - ApiBase::PARAM_DFLT => |
129 | | - !$wgFlaggedRevsNamespaces ? |
130 | | - NS_MAIN : |
131 | | - $wgFlaggedRevsNamespaces[0], |
| 128 | + ApiBase::PARAM_DFLT => !$namespaces ? |
| 129 | + NS_MAIN : $namespaces[0], |
132 | 130 | ApiBase::PARAM_TYPE => 'namespace', |
133 | 131 | ApiBase::PARAM_ISMULTI => true, |
134 | 132 | ), |