r68642 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68641‎ | r68642 | r68643 >
Date:20:27, 27 June 2010
Author:aaron
Status:ok
Tags:
Comment:
* Renamed useOnlyIfStabilized() -> useOnlyIfProtected
* Review time stats:
** Query fix for autoreviewed edits
** Used flaggedpage_pending table to get $worstLagTS
** Made review time stats more recent (without bais)
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevision.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateStats.inc (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ValidationStatistics_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -522,7 +522,7 @@
523523 function efSetFlaggedRevsConditionalHooks() {
524524 global $wgHooks, $wgFlaggedRevsVisible;
525525 # Mark items in user contribs
526 - if ( !FlaggedRevs::useOnlyIfStabilized() ) {
 526+ if ( !FlaggedRevs::useOnlyIfProtected() ) {
527527 $wgHooks['ContribsPager::getQueryInfo'][] = 'FlaggedRevsHooks::addToContribsQuery';
528528 $wgHooks['ContributionsLineEnding'][] = 'FlaggedRevsHooks::addToContribsLine';
529529 }
@@ -557,7 +557,7 @@
558558 }
559559 /* TODO: decouple from rc patrol */
560560 # Check if FlaggedRevs is enabled by default for pages...
561 - if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfStabilized() ) {
 561+ if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfProtected() ) {
562562 # Use RC Patrolling to check for vandalism.
563563 # Edits to reviewable pages must be flagged to be patrolled.
564564 $wgUseRCPatrol = true;
@@ -574,7 +574,7 @@
575575
576576 function efSetFlaggedRevsConditionalAPIModules() {
577577 global $wgAPIModules, $wgAPIListModules;
578 - if ( FlaggedRevs::useOnlyIfStabilized() ) {
 578+ if ( FlaggedRevs::useOnlyIfProtected() ) {
579579 $wgAPIModules['stabilize'] = 'ApiStabilizeProtect';
580580 } else {
581581 $wgAPIModules['stabilize'] = 'ApiStabilizeGeneral';
@@ -585,7 +585,7 @@
586586
587587 function efSetFlaggedRevsConditionalRights() {
588588 global $wgGroupPermissions, $wgImplicitGroups, $wgFlaggedRevsAutoconfirm;
589 - if ( FlaggedRevs::useOnlyIfStabilized() ) {
 589+ if ( FlaggedRevs::useOnlyIfProtected() ) {
590590 // Removes sp:ListGroupRights cruft
591591 if ( isset( $wgGroupPermissions['editor'] ) ) {
592592 unset( $wgGroupPermissions['editor']['unreviewedpages'] );
Index: trunk/extensions/FlaggedRevs/maintenance/updateStats.inc
@@ -108,7 +108,7 @@
109109 global $wgFlaggedRevsNamespaces;
110110 $aveRT = $medianRT = 0;
111111 $rPerTable = array(); // review wait percentiles
112 - if ( FlaggedRevs::useOnlyIfStabilized() ) {
 112+ if ( FlaggedRevs::useOnlyIfProtected() ) {
113113 return array($aveRT,$medianRT,$rPerTable); // disabled
114114 }
115115 $nowUnix = wfTimestamp( TS_UNIX ); // current time in UNIX TS
@@ -130,39 +130,40 @@
131131 $last = '0';
132132 while ( true ) { // should almost always be ~1 pass
133133 # 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
142141 ),
143142 __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' ) )
146145 );
147146 if ( !$row ) break;
148147 # Find the newest revision at the time the page was reviewed,
149148 # this is the one that *should* have been reviewed.
150149 $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 ) ),
153152 __METHOD__,
154153 array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 1 )
155154 );
156155 # Fudge factor to prevent deliberate reviewing of non-current revisions
157156 # 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;
160159 break;
161160 } else {
162 - $last = $row->fp_pending_since; // next iteration
 161+ $last = $row->fpp_pending_since; // next iteration
163162 }
164163 }
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
167168 $encMaxTS = $dbr->addQuotes( $dbr->timestamp( $maxTSUnix ) );
168169 # Use a one week time range
169170 $days = 7;
@@ -222,7 +223,7 @@
223224 INNER JOIN $flaggedrevs AS p FORCE INDEX (PRIMARY) ON
224225 (p.fr_page_id = page_id AND p.fr_rev_id < rev_id AND p.fr_timestamp < rev_timestamp)
225226 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)
227228 WHERE
228229 ((rev_user = 0) AND ($timeCondition) AND ((rev_id % $mod) = 0))
229230 GROUP BY rev_id";
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -243,7 +243,7 @@
244244 if ( !FlaggedRevs::inReviewNamespace( $this->getTitle() ) ) {
245245 return false;
246246 }
247 - return !( FlaggedRevs::useOnlyIfStabilized()
 247+ return !( FlaggedRevs::useOnlyIfProtected()
248248 && !$this->isStableShownByDefault( $flags ) );
249249 }
250250
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -186,7 +186,7 @@
187187 */
188188 public static function isStableShownByDefault() {
189189 global $wgFlaggedRevsOverride;
190 - if ( self::useOnlyIfStabilized() ) {
 190+ if ( self::useOnlyIfProtected() ) {
191191 return false; // must be configured per-page
192192 }
193193 return (bool)$wgFlaggedRevsOverride;
@@ -197,7 +197,7 @@
198198 * configured by an admin to use a "stable version" as the default?
199199 * @returns bool
200200 */
201 - public static function useOnlyIfStabilized() {
 201+ public static function useOnlyIfProtected() {
202202 global $wgFlaggedRevsProtection;
203203 return (bool)$wgFlaggedRevsProtection;
204204 }
@@ -1136,7 +1136,7 @@
11371137 // If FlaggedRevs got "turned off" for this page (due to not
11381138 // having the stable version as the default), then clear it
11391139 // from the tracking tables...
1140 - if ( !$config['override'] && self::useOnlyIfStabilized() ) {
 1140+ if ( !$config['override'] && self::useOnlyIfProtected() ) {
11411141 $pagesClearTracking[] = $row->fpc_page_id; // no stable version
11421142 // Check if the new (default) config has a different way
11431143 // of selecting the stable version of this page...
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php
@@ -154,7 +154,7 @@
155155 if ( empty( $config ) ) {
156156 $config = FlaggedRevs::getPageVisibilitySettings( $title, $flags );
157157 }
158 - if ( !$config['override'] && FlaggedRevs::useOnlyIfStabilized() ) {
 158+ if ( !$config['override'] && FlaggedRevs::useOnlyIfProtected() ) {
159159 return $row; // page is not reviewable; no stable version
160160 }
161161 $dbw = wfGetDB( DB_MASTER );
Index: trunk/extensions/FlaggedRevs/specialpages/ValidationStatistics_body.php
@@ -65,7 +65,7 @@
6666 $wgOut->addWikiText(
6767 wfMsgExt( 'validationstatistics-pndtime', 'parsemag', $wgLang->formatTimePeriod( $pt ) )
6868 );
69 - if ( !FlaggedRevs::useOnlyIfStabilized() ) {
 69+ if ( !FlaggedRevs::useOnlyIfProtected() ) {
7070 # Show review time stats
7171 $wgOut->addWikiText( wfMsgExt( 'validationstatistics-revtime', 'parsemag',
7272 $wgLang->formatTimePeriod( $mt ), $wgLang->formatTimePeriod( $mdt ), $reviewChart )
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -71,7 +71,7 @@
7272 '</span> '
7373 : ""
7474 ) .
75 - ( ( !FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfStabilized() )
 75+ ( ( !FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfProtected() )
7676 ? "<span style='white-space: nowrap;'>" .
7777 Xml::check( 'stable', $this->stable, array( 'id' => 'wpStable' ) ) .
7878 Xml::label( wfMsg( 'oldreviewed-stable' ), 'wpStable' ) . '</span> '
@@ -299,7 +299,7 @@
300300 $this->size = ( $size !== null ) ? intval( $size ) : null;
301301 $this->watched = (bool)$watched;
302302 $this->stable = $stable && !FlaggedRevs::isStableShownByDefault()
303 - && !FlaggedRevs::useOnlyIfStabilized();
 303+ && !FlaggedRevs::useOnlyIfProtected();
304304 parent::__construct();
305305 // Don't get too expensive
306306 $this->mLimitsShown = array( 20, 50, 100 );
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -24,7 +24,7 @@
2525 if ( $wgUseTagFilter && ChangeTags::listDefinedTags() ) {
2626 $list['ProblemChanges'] = $wgSpecialPages['ProblemChanges'] = 'ProblemChanges';
2727 }
28 - if ( !FlaggedRevs::useOnlyIfStabilized() ) {
 28+ if ( !FlaggedRevs::useOnlyIfProtected() ) {
2929 $list['ReviewedPages'] = $wgSpecialPages['ReviewedPages'] = 'ReviewedPages';
3030 $list['UnreviewedPages'] = $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages';
3131 }
@@ -1940,7 +1940,7 @@
19411941 if ( $rc->mAttribs['fp_stable'] == null ) {
19421942 // Is this a config were pages start off reviewable?
19431943 // 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' ) ) {
19451945 $rlink = wfMsgHtml( 'revreview-unreviewedpage' );
19461946 $css = 'flaggedrevs-unreviewed';
19471947 }
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -657,7 +657,7 @@
658658
659659 // Show icons for draft/stable/old reviewed versions
660660 protected function showRatingIcon() {
661 - if ( FlaggedRevs::useOnlyIfStabilized() ) {
 661+ if ( FlaggedRevs::useOnlyIfProtected() ) {
662662 // If there is only one quality level and we have tabs to know
663663 // which version we are looking at, then just use the lock icon...
664664 return FlaggedRevs::qualityVersions();
@@ -974,7 +974,7 @@
975975 if ( !$wgUser->isAllowed( 'review' ) ) {
976976 return true;
977977 }
978 - if ( !FlaggedRevs::useOnlyIfStabilized() ) {
 978+ if ( !FlaggedRevs::useOnlyIfProtected() ) {
979979 $links = array();
980980 $category = $this->article->getTitle()->getText();
981981 # Add link to list of unreviewed pages in this category

Status & tagging log