r68595 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68594‎ | r68595 | r68596 >
Date:01:04, 26 June 2010
Author:aaron
Status:ok
Tags:
Comment:
* Removed $wgFlaggedRevsReviewForDefault as ugly stand-alone setting (YAGNI) and merged with $wgFlaggedRevsProtection which it is currently used with.
* Renamed stableOnlyIfConfigured -> useOnlyIfStabilized
* Removed forDefaultVersionOnly(), useOnlyIfStabilized() used instead
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/language/FlaggedRevs.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateStats.inc (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -87,10 +87,9 @@
8888 $wgFlaggedRevsWhitelist = array();
8989 # $wgFlaggedRevsWhitelist = array( 'Main_Page' );
9090
91 -# Do flagged revs override the default view?
 91+# Is a "stable version" used as the default display
 92+# version for all pages in reviewable namespaces?
9293 $wgFlaggedRevsOverride = true;
93 -# Are pages only reviewable if the stable shows by default?
94 -$wgFlaggedRevsReviewForDefault = false;
9594 # Precedence order for stable version selection.
9695 # The stable version will be the highest ranked version in the page.
9796 # FR_PRISTINE : "pristine" > "quality" > "sighted"
@@ -143,9 +142,11 @@
144143 # requires approval unless that user has the specified permission.
145144 # Levels are set at the Stabilization special page.
146145 $wgFlaggedRevsRestrictionLevels = array( '', 'sysop' );
147 -# Set this to disable Stabilization and show the above restriction levels
 146+# Set this to use FlaggedRevs *only* as a protection-like mechanism.
 147+# This will disable Stabilization and show the above restriction levels
148148 # on the protection form of pages. Each level has the stable version shown by default.
149 -# A "none" level will appear in the forms as well, to restore the default settings.
 149+# A "none" level will appear in the form as well, to disable the review process.
 150+# Pages will only be reviewable if manually restricted to a level above "none".
150151 # NOTE: The stable version precedence cannot be configured per page with this.
151152 $wgFlaggedRevsProtection = false;
152153
@@ -261,7 +262,7 @@
262263 # pointed to by the metadata of how the article was when it was reviewed.
263264 # An example would be an article that selects a template based on time.
264265 # The template to be selected will change, and the metadata only points
265 -# to the reviewed revision ID of the old template. In such cases, we can s
 266+# to the reviewed revision ID of the old template. In such cases, we can
266267 # select the current (unreviewed) revision.
267268 $wgUseCurrentTemplates = true;
268269
@@ -522,7 +523,7 @@
523524 function efSetFlaggedRevsConditionalHooks() {
524525 global $wgHooks, $wgFlaggedRevsVisible;
525526 # Mark items in user contribs
526 - if ( !FlaggedRevs::stableOnlyIfConfigured() ) {
 527+ if ( !FlaggedRevs::useOnlyIfStabilized() ) {
527528 $wgHooks['ContribsPager::getQueryInfo'][] = 'FlaggedRevsHooks::addToContribsQuery';
528529 $wgHooks['ContributionsLineEnding'][] = 'FlaggedRevsHooks::addToContribsLine';
529530 }
@@ -557,7 +558,7 @@
558559 }
559560 /* TODO: decouple from rc patrol */
560561 # Check if FlaggedRevs is enabled by default for pages...
561 - if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::stableOnlyIfConfigured() ) {
 562+ if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfStabilized() ) {
562563 # Use RC Patrolling to check for vandalism.
563564 # Edits to reviewable pages must be flagged to be patrolled.
564565 $wgUseRCPatrol = true;
@@ -574,7 +575,7 @@
575576
576577 function efSetFlaggedRevsConditionalAPIModules() {
577578 global $wgAPIModules, $wgAPIListModules;
578 - if ( FlaggedRevs::stableOnlyIfConfigured() ) {
 579+ if ( FlaggedRevs::useOnlyIfStabilized() ) {
579580 $wgAPIModules['stabilize'] = 'ApiStabilizeProtect';
580581 } else {
581582 $wgAPIModules['stabilize'] = 'ApiStabilizeGeneral';
@@ -585,7 +586,7 @@
586587
587588 function efSetFlaggedRevsConditionalRights() {
588589 global $wgGroupPermissions, $wgImplicitGroups, $wgFlaggedRevsAutoconfirm;
589 - if ( FlaggedRevs::stableOnlyIfConfigured() ) {
 590+ if ( FlaggedRevs::useOnlyIfStabilized() ) {
590591 // Removes sp:ListGroupRights cruft
591592 if ( isset( $wgGroupPermissions['editor'] ) ) {
592593 unset( $wgGroupPermissions['editor']['unreviewedpages'] );
Index: trunk/extensions/FlaggedRevs/maintenance/updateStats.inc
@@ -143,7 +143,7 @@
144144 $minTS = max($minTS,$installed);
145145 # Get timestamp boundaries
146146 $timeCondition = 'rev_timestamp BETWEEN '.$encMinTS.' AND '.$encMaxTS;
147 - if ( FlaggedRevs::stableOnlyIfConfigured() ) {
 147+ if ( FlaggedRevs::useOnlyIfStabilized() ) {
148148 $mod = 1; // can't estimate $mod based on all edits in the range
149149 } else {
150150 # Modulus (to spread out over range)
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -262,7 +262,6 @@
263263
264264 'flaggedrevs-protect-legend' => 'Automatic edit review ([[{{MediaWiki:Validationpage}}|help]])',
265265 'flaggedrevs-protect-none' => 'Allow all users',
266 - 'flaggedrevs-protect-basic' => 'Default settings',
267266
268267 'revreview-locked-title' => 'Edits must be reviewed before being displayed to readers on this page.',
269268 'revreview-unlocked-title' => 'Edits do not require review before being displayed to readers on this page.',
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -243,7 +243,7 @@
244244 if ( !FlaggedRevs::inReviewNamespace( $this->getTitle() ) ) {
245245 return false;
246246 }
247 - return !( FlaggedRevs::forDefaultVersionOnly()
 247+ return !( FlaggedRevs::useOnlyIfStabilized()
248248 && !$this->isStableShownByDefault( $flags ) );
249249 }
250250
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -173,34 +173,31 @@
174174 global $wgFlaggedRevsAutoReviewNew;
175175 return (bool)$wgFlaggedRevsAutoReviewNew;
176176 }
177 -
 177+
178178 /**
179 - * Should this user see stable versions by default?
 179+ * Is a "stable version" used as the default display
 180+ * version for all pages in reviewable namespaces?
180181 * @returns bool
181182 */
182183 public static function isStableShownByDefault() {
183184 global $wgFlaggedRevsOverride;
 185+ if ( self::useOnlyIfStabilized() ) {
 186+ return false; // must be configured per-page
 187+ }
184188 return (bool)$wgFlaggedRevsOverride;
185189 }
186190
187191 /**
188 - * Does FlaggedRevs only show for pages were the stable version is the default?
 192+ * Are pages reviewable only if they have been manually
 193+ * configured by an admin to use a "stable version" as the default?
189194 * @returns bool
190195 */
191 - public static function forDefaultVersionOnly() {
192 - global $wgFlaggedRevsReviewForDefault;
193 - return (bool)$wgFlaggedRevsReviewForDefault;
 196+ public static function useOnlyIfStabilized() {
 197+ global $wgFlaggedRevsProtection;
 198+ return (bool)$wgFlaggedRevsProtection;
194199 }
195200
196201 /**
197 - * Does FlaggedRevs only show for pages that have been set to do so?
198 - * @returns bool
199 - */
200 - public static function stableOnlyIfConfigured() {
201 - return self::forDefaultVersionOnly() && !self::isStableShownByDefault();
202 - }
203 -
204 - /**
205202 * Return the include handling configuration
206203 * @returns int
207204 */
@@ -1133,7 +1130,7 @@
11341131 // If FlaggedRevs got "turned off" for this page (due to not
11351132 // having the stable version as the default), then clear it
11361133 // from the tracking tables...
1137 - if ( !$config['override'] && self::forDefaultVersionOnly() ) {
 1134+ if ( !$config['override'] && self::useOnlyIfStabilized() ) {
11381135 $pagesClearTracking[] = $row->fpc_page_id; // no stable version
11391136 // Check if the new (default) config has a different way
11401137 // 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::forDefaultVersionOnly() ) {
 158+ if ( !$config['override'] && FlaggedRevs::useOnlyIfStabilized() ) {
159159 return $row; // page is not reviewable; no stable version
160160 }
161161 $dbw = wfGetDB( DB_MASTER );
Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
@@ -235,7 +235,7 @@
236236 $this->level = intval( $level );
237237 $this->showredirs = (bool)$redirs;
238238 parent::__construct();
239 - // Don't get to expensive
 239+ // Don't get too expensive
240240 $this->mLimitsShown = array( 20, 50 );
241241 $this->mLimit = min( $this->mLimit, 50 );
242242 }
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -71,8 +71,7 @@
7272 '</span> '
7373 : ""
7474 ) .
75 - ( ( !FlaggedRevs::isStableShownByDefault()
76 - && !FlaggedRevs::forDefaultVersionOnly() )
 75+ ( ( !FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::useOnlyIfStabilized() )
7776 ? "<span style='white-space: nowrap;'>" .
7877 Xml::check( 'stable', $this->stable, array( 'id' => 'wpStable' ) ) .
7978 Xml::label( wfMsg( 'oldreviewed-stable' ), 'wpStable' ) . '</span> '
@@ -300,9 +299,9 @@
301300 $this->size = ( $size !== null ) ? intval( $size ) : null;
302301 $this->watched = (bool)$watched;
303302 $this->stable = $stable && !FlaggedRevs::isStableShownByDefault()
304 - && !FlaggedRevs::forDefaultVersionOnly();
 303+ && !FlaggedRevs::useOnlyIfStabilized();
305304 parent::__construct();
306 - // Don't get to expensive
 305+ // Don't get too expensive
307306 $this->mLimitsShown = array( 20, 50, 100 );
308307 $this->mLimit = min( $this->mLimit, 100 );
309308 }
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::stableOnlyIfConfigured() ) {
 28+ if ( !FlaggedRevs::useOnlyIfStabilized() ) {
2929 $list['ReviewedPages'] = $wgSpecialPages['ReviewedPages'] = 'ReviewedPages';
3030 $list['UnreviewedPages'] = $wgSpecialPages['UnreviewedPages'] = 'UnreviewedPages';
3131 }
@@ -1930,7 +1930,7 @@
19311931 if ( $rc->mAttribs['fp_stable'] == null ) {
19321932 // Is this a config were pages start off reviewable?
19331933 // Hide notice from non-reviewers due to vandalism concerns (bug 24002).
1934 - if ( !FlaggedRevs::stableOnlyIfConfigured() && $wgUser->isAllowed( 'review' ) ) {
 1934+ if ( !FlaggedRevs::useOnlyIfStabilized() && $wgUser->isAllowed( 'review' ) ) {
19351935 $rlink = wfMsgHtml( 'revreview-unreviewedpage' );
19361936 $css = 'flaggedrevs-unreviewed';
19371937 }
@@ -2085,9 +2085,7 @@
20862086 $output .= Xml::openElement( 'select', $attribs );
20872087 foreach ( $effectiveLevels as $limit ) {
20882088 if ( $limit == 'none' ) {
2089 - $label = FlaggedRevs::stableOnlyIfConfigured()
2090 - ? wfMsg( 'flaggedrevs-protect-none' )
2091 - : wfMsg( 'flaggedrevs-protect-basic' );
 2089+ $label = wfMsg( 'flaggedrevs-protect-none' );
20922090 } else {
20932091 $label = wfMsg( 'flaggedrevs-protect-' . $limit );
20942092 }
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -654,11 +654,11 @@
655655 }
656656 return '';
657657 }
658 -
 658+
659659 // Show icons for draft/stable/old reviewed versions
660660 protected function showRatingIcon() {
661 - if ( FlaggedRevs::forDefaultVersionOnly() ) {
662 - // If there is only on quality level and we have tabs to know
 661+ if ( FlaggedRevs::useOnlyIfStabilized() ) {
 662+ // 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();
665665 }
@@ -974,7 +974,7 @@
975975 if ( !$wgUser->isAllowed( 'review' ) ) {
976976 return true;
977977 }
978 - if ( !FlaggedRevs::stableOnlyIfConfigured() ) {
 978+ if ( !FlaggedRevs::useOnlyIfStabilized() ) {
979979 $links = array();
980980 $category = $this->article->getTitle()->getText();
981981 # Add link to list of unreviewed pages in this category

Status & tagging log