Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -522,7 +522,7 @@ |
523 | 523 | function efSetFlaggedRevsConditionalHooks() { |
524 | 524 | global $wgHooks, $wgFlaggedRevsVisible; |
525 | 525 | # Mark items in user contribs |
526 | | - if ( !FlaggedRevs::useOnlyIfStabilized() ) { |
| 526 | + if ( !FlaggedRevs::useOnlyIfProtected() ) { |
527 | 527 | $wgHooks['ContribsPager::getQueryInfo'][] = 'FlaggedRevsHooks::addToContribsQuery'; |
528 | 528 | $wgHooks['ContributionsLineEnding'][] = 'FlaggedRevsHooks::addToContribsLine'; |
529 | 529 | } |
— | — | @@ -557,7 +557,7 @@ |
558 | 558 | } |
559 | 559 | /* TODO: decouple from rc patrol */ |
560 | 560 | # Check if FlaggedRevs is enabled by default for pages... |
561 | | - if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfStabilized() ) { |
| 561 | + if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfProtected() ) { |
562 | 562 | # Use RC Patrolling to check for vandalism. |
563 | 563 | # Edits to reviewable pages must be flagged to be patrolled. |
564 | 564 | $wgUseRCPatrol = true; |
— | — | @@ -574,7 +574,7 @@ |
575 | 575 | |
576 | 576 | function efSetFlaggedRevsConditionalAPIModules() { |
577 | 577 | global $wgAPIModules, $wgAPIListModules; |
578 | | - if ( FlaggedRevs::useOnlyIfStabilized() ) { |
| 578 | + if ( FlaggedRevs::useOnlyIfProtected() ) { |
579 | 579 | $wgAPIModules['stabilize'] = 'ApiStabilizeProtect'; |
580 | 580 | } else { |
581 | 581 | $wgAPIModules['stabilize'] = 'ApiStabilizeGeneral'; |
— | — | @@ -585,7 +585,7 @@ |
586 | 586 | |
587 | 587 | function efSetFlaggedRevsConditionalRights() { |
588 | 588 | global $wgGroupPermissions, $wgImplicitGroups, $wgFlaggedRevsAutoconfirm; |
589 | | - if ( FlaggedRevs::useOnlyIfStabilized() ) { |
| 589 | + if ( FlaggedRevs::useOnlyIfProtected() ) { |
590 | 590 | // Removes sp:ListGroupRights cruft |
591 | 591 | if ( isset( $wgGroupPermissions['editor'] ) ) { |
592 | 592 | unset( $wgGroupPermissions['editor']['unreviewedpages'] ); |
Index: trunk/extensions/FlaggedRevs/maintenance/updateStats.inc |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | global $wgFlaggedRevsNamespaces; |
110 | 110 | $aveRT = $medianRT = 0; |
111 | 111 | $rPerTable = array(); // review wait percentiles |
112 | | - if ( FlaggedRevs::useOnlyIfStabilized() ) { |
| 112 | + if ( FlaggedRevs::useOnlyIfProtected() ) { |
113 | 113 | return array($aveRT,$medianRT,$rPerTable); // disabled |
114 | 114 | } |
115 | 115 | $nowUnix = wfTimestamp( TS_UNIX ); // current time in UNIX TS |
— | — | @@ -130,39 +130,40 @@ |
131 | 131 | $last = '0'; |
132 | 132 | while ( true ) { // should almost always be ~1 pass |
133 | 133 | # Get the page with the worst pending lag... |
134 | | - $row = $dbr->selectRow( array( 'flaggedpages', 'flaggedrevs', 'page' ), |
135 | | - array( 'fp_page_id', 'fp_stable', 'fp_pending_since', 'fr_timestamp' ), |
136 | | - array( |
137 | | - 'fp_pending_since > '.$encInstalled, // needs actual display lag |
138 | | - 'fr_page_id = fp_page_id AND fr_rev_id = fp_stable', |
139 | | - 'fp_pending_since > '.$dbr->addQuotes($last), // skip failed rows |
140 | | - 'page_id = fp_page_id', // get page title |
141 | | - 'page_namespace' => $wgFlaggedRevsNamespaces // sanity check NS |
| 134 | + $row = $dbr->selectRow( array( 'flaggedpage_pending', 'flaggedrevs' ), |
| 135 | + array( 'fpp_page_id', 'fpp_rev_id', 'fpp_pending_since', 'fr_timestamp' ), |
| 136 | + array( |
| 137 | + 'fpp_quality' => 0, // "checked" |
| 138 | + 'fpp_pending_since > '.$encInstalled, // needs actual display lag |
| 139 | + 'fr_page_id = fpp_page_id AND fr_rev_id = fpp_rev_id', |
| 140 | + 'fpp_pending_since > '.$dbr->addQuotes($last), // skip failed rows |
142 | 141 | ), |
143 | 142 | __METHOD__, |
144 | | - array( 'ORDER BY' => 'fp_pending_since ASC', |
145 | | - 'USE INDEX' => array( 'flaggedpages' => 'fp_pending_since' ) ) |
| 143 | + array( 'ORDER BY' => 'fpp_pending_since ASC', |
| 144 | + 'USE INDEX' => array( 'flaggedpage_pending' => 'fpp_quality_pending' ) ) |
146 | 145 | ); |
147 | 146 | if ( !$row ) break; |
148 | 147 | # Find the newest revision at the time the page was reviewed, |
149 | 148 | # this is the one that *should* have been reviewed. |
150 | 149 | $idealRev = (int)$dbr->selectField( 'revision', 'rev_id', |
151 | | - array( 'rev_page' => $row->fp_page_id, |
152 | | - 'rev_timestamp < '.$dbr->addQuotes($row->fr_timestamp) ), |
| 150 | + array( 'rev_page' => $row->fpp_page_id, |
| 151 | + 'rev_timestamp < '.$dbr->addQuotes( $row->fr_timestamp ) ), |
153 | 152 | __METHOD__, |
154 | 153 | array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 1 ) |
155 | 154 | ); |
156 | 155 | # Fudge factor to prevent deliberate reviewing of non-current revisions |
157 | 156 | # from squeezing the range. Shouldn't effect anything otherwise. |
158 | | - if ( $row->fp_stable >= $idealRev ) { |
159 | | - $worstLagTS = $row->fp_pending_since; |
| 157 | + if ( $row->fpp_rev_id >= $idealRev ) { |
| 158 | + $worstLagTS = $row->fpp_pending_since; |
160 | 159 | break; |
161 | 160 | } else { |
162 | | - $last = $row->fp_pending_since; // next iteration |
| 161 | + $last = $row->fpp_pending_since; // next iteration |
163 | 162 | } |
164 | 163 | } |
165 | | - # Add a day for good measure to avoid bias |
166 | | - $maxTSUnix = wfTimestamp(TS_UNIX,$worstLagTS) - 86400; |
| 164 | + # Avoid having to censor data |
| 165 | + # Note: if no edits pending, $worstLagTS is the cur time just before we checked |
| 166 | + # for the worst lag. Thus, new edits *right* after the check are properly excluded. |
| 167 | + $maxTSUnix = wfTimestamp(TS_UNIX,$worstLagTS) - 1; // all edits later reviewed |
167 | 168 | $encMaxTS = $dbr->addQuotes( $dbr->timestamp( $maxTSUnix ) ); |
168 | 169 | # Use a one week time range |
169 | 170 | $days = 7; |
— | — | @@ -222,7 +223,7 @@ |
223 | 224 | INNER JOIN $flaggedrevs AS p FORCE INDEX (PRIMARY) ON |
224 | 225 | (p.fr_page_id = page_id AND p.fr_rev_id < rev_id AND p.fr_timestamp < rev_timestamp) |
225 | 226 | LEFT JOIN $flaggedrevs AS n FORCE INDEX (PRIMARY) ON |
226 | | - (n.fr_page_id = page_id AND n.fr_rev_id >= rev_id AND n.fr_timestamp > rev_timestamp) |
| 227 | + (n.fr_page_id = page_id AND n.fr_rev_id >= rev_id AND n.fr_timestamp >= rev_timestamp) |
227 | 228 | WHERE |
228 | 229 | ((rev_user = 0) AND ($timeCondition) AND ((rev_id % $mod) = 0)) |
229 | 230 | GROUP BY rev_id"; |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -243,7 +243,7 @@ |
244 | 244 | if ( !FlaggedRevs::inReviewNamespace( $this->getTitle() ) ) { |
245 | 245 | return false; |
246 | 246 | } |
247 | | - return !( FlaggedRevs::useOnlyIfStabilized() |
| 247 | + return !( FlaggedRevs::useOnlyIfProtected() |
248 | 248 | && !$this->isStableShownByDefault( $flags ) ); |
249 | 249 | } |
250 | 250 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -186,7 +186,7 @@ |
187 | 187 | */ |
188 | 188 | public static function isStableShownByDefault() { |
189 | 189 | global $wgFlaggedRevsOverride; |
190 | | - if ( self::useOnlyIfStabilized() ) { |
| 190 | + if ( self::useOnlyIfProtected() ) { |
191 | 191 | return false; // must be configured per-page |
192 | 192 | } |
193 | 193 | return (bool)$wgFlaggedRevsOverride; |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | * configured by an admin to use a "stable version" as the default? |
199 | 199 | * @returns bool |
200 | 200 | */ |
201 | | - public static function useOnlyIfStabilized() { |
| 201 | + public static function useOnlyIfProtected() { |
202 | 202 | global $wgFlaggedRevsProtection; |
203 | 203 | return (bool)$wgFlaggedRevsProtection; |
204 | 204 | } |
— | — | @@ -1136,7 +1136,7 @@ |
1137 | 1137 | // If FlaggedRevs got "turned off" for this page (due to not |
1138 | 1138 | // having the stable version as the default), then clear it |
1139 | 1139 | // from the tracking tables... |
1140 | | - if ( !$config['override'] && self::useOnlyIfStabilized() ) { |
| 1140 | + if ( !$config['override'] && self::useOnlyIfProtected() ) { |
1141 | 1141 | $pagesClearTracking[] = $row->fpc_page_id; // no stable version |
1142 | 1142 | // Check if the new (default) config has a different way |
1143 | 1143 | // of selecting the stable version of this page... |
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php |
— | — | @@ -154,7 +154,7 @@ |
155 | 155 | if ( empty( $config ) ) { |
156 | 156 | $config = FlaggedRevs::getPageVisibilitySettings( $title, $flags ); |
157 | 157 | } |
158 | | - if ( !$config['override'] && FlaggedRevs::useOnlyIfStabilized() ) { |
| 158 | + if ( !$config['override'] && FlaggedRevs::useOnlyIfProtected() ) { |
159 | 159 | return $row; // page is not reviewable; no stable version |
160 | 160 | } |
161 | 161 | $dbw = wfGetDB( DB_MASTER ); |
Index: trunk/extensions/FlaggedRevs/specialpages/ValidationStatistics_body.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $wgOut->addWikiText( |
67 | 67 | wfMsgExt( 'validationstatistics-pndtime', 'parsemag', $wgLang->formatTimePeriod( $pt ) ) |
68 | 68 | ); |
69 | | - if ( !FlaggedRevs::useOnlyIfStabilized() ) { |
| 69 | + if ( !FlaggedRevs::useOnlyIfProtected() ) { |
70 | 70 | # Show review time stats |
71 | 71 | $wgOut->addWikiText( wfMsgExt( 'validationstatistics-revtime', 'parsemag', |
72 | 72 | $wgLang->formatTimePeriod( $mt ), $wgLang->formatTimePeriod( $mdt ), $reviewChart ) |
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | '</span> ' |
73 | 73 | : "" |
74 | 74 | ) . |
75 | | - ( ( !FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfStabilized() ) |
| 75 | + ( ( !FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected() ) |
76 | 76 | ? "<span style='white-space: nowrap;'>" . |
77 | 77 | Xml::check( 'stable', $this->stable, array( 'id' => 'wpStable' ) ) . |
78 | 78 | Xml::label( wfMsg( 'oldreviewed-stable' ), 'wpStable' ) . '</span> ' |
— | — | @@ -299,7 +299,7 @@ |
300 | 300 | $this->size = ( $size !== null ) ? intval( $size ) : null; |
301 | 301 | $this->watched = (bool)$watched; |
302 | 302 | $this->stable = $stable && !FlaggedRevs::isStableShownByDefault() |
303 | | - && !FlaggedRevs::useOnlyIfStabilized(); |
| 303 | + && !FlaggedRevs::useOnlyIfProtected(); |
304 | 304 | parent::__construct(); |
305 | 305 | // Don't get too expensive |
306 | 306 | $this->mLimitsShown = array( 20, 50, 100 ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | if ( $wgUseTagFilter && ChangeTags::listDefinedTags() ) { |
26 | 26 | $list['ProblemChanges'] = $wgSpecialPages['ProblemChanges'] = 'ProblemChanges'; |
27 | 27 | } |
28 | | - if ( !FlaggedRevs::useOnlyIfStabilized() ) { |
| 28 | + if ( !FlaggedRevs::useOnlyIfProtected() ) { |
29 | 29 | $list['ReviewedPages'] = $wgSpecialPages['ReviewedPages'] = 'ReviewedPages'; |
30 | 30 | $list['UnreviewedPages'] = $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages'; |
31 | 31 | } |
— | — | @@ -1940,7 +1940,7 @@ |
1941 | 1941 | if ( $rc->mAttribs['fp_stable'] == null ) { |
1942 | 1942 | // Is this a config were pages start off reviewable? |
1943 | 1943 | // Hide notice from non-reviewers due to vandalism concerns (bug 24002). |
1944 | | - if ( !FlaggedRevs::useOnlyIfStabilized() && $wgUser->isAllowed( 'review' ) ) { |
| 1944 | + if ( !FlaggedRevs::useOnlyIfProtected() && $wgUser->isAllowed( 'review' ) ) { |
1945 | 1945 | $rlink = wfMsgHtml( 'revreview-unreviewedpage' ); |
1946 | 1946 | $css = 'flaggedrevs-unreviewed'; |
1947 | 1947 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -657,7 +657,7 @@ |
658 | 658 | |
659 | 659 | // Show icons for draft/stable/old reviewed versions |
660 | 660 | protected function showRatingIcon() { |
661 | | - if ( FlaggedRevs::useOnlyIfStabilized() ) { |
| 661 | + if ( FlaggedRevs::useOnlyIfProtected() ) { |
662 | 662 | // If there is only one quality level and we have tabs to know |
663 | 663 | // which version we are looking at, then just use the lock icon... |
664 | 664 | return FlaggedRevs::qualityVersions(); |
— | — | @@ -974,7 +974,7 @@ |
975 | 975 | if ( !$wgUser->isAllowed( 'review' ) ) { |
976 | 976 | return true; |
977 | 977 | } |
978 | | - if ( !FlaggedRevs::useOnlyIfStabilized() ) { |
| 978 | + if ( !FlaggedRevs::useOnlyIfProtected() ) { |
979 | 979 | $links = array(); |
980 | 980 | $category = $this->article->getTitle()->getText(); |
981 | 981 | # Add link to list of unreviewed pages in this category |