r41040 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41039‎ | r41040 | r41041 >
Date:18:45, 19 September 2008
Author:aaron
Status:old
Tags:
Comment:
* Add $wgFlaggedRevsReviewForDefault
* Remove now unused var and commented out code
* Improve $row existence check in getPageVisibilitySettings()
* Invalidate cache when settings expire
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -82,6 +82,8 @@
8383
8484 # Do flagged revs override the default view?
8585 $wgFlaggedRevsOverride = true;
 86+# Are pages only reviewable if the stable shows by default?
 87+$wgFlaggedRevsReviewForDefault = false;
8688 # Do quality revisions show instead of sighted if present by default?
8789 $wgFlaggedRevsPrecedence = true;
8890 # Revision tagging can slow development...
@@ -228,8 +230,6 @@
229231 # How far the logs for overseeing quality revisions and depreciations go
230232 $wgFlaggedRevsOversightAge = 7 * 24 * 3600;
231233
232 -# How many hours pending review is considering long?
233 -$wgFlaggedRevsLongPending = array( 3, 12, 24 );
234234 # How many pages count as a backlog?
235235 $wgFlaggedRevsBacklog = 2000;
236236
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -145,7 +145,12 @@
146146 * Is this article reviewable?
147147 */
148148 public function isReviewable() {
149 - return FlaggedRevs::isPageReviewable( $this->parent->getTitle() );
 149+ global $wgFlaggedRevsReviewForDefault;
 150+ if( !FlaggedRevs::isPageReviewable( $this->parent->getTitle() ) )
 151+ return false;
 152+ if( $wgFlaggedRevsReviewForDefault && !$this->showStableByDefault() )
 153+ return false;
 154+ return true;
150155 }
151156
152157 /**
@@ -730,24 +735,27 @@
731736 */
732737 public function addVisibilityLink( &$data ) {
733738 global $wgUser, $wgRequest, $wgOut;
734 - if( !$this->isReviewable() ) {
 739+ # Check only if the title is reviewable
 740+ if( !FlaggedRevs::isPageReviewable( $this->parent->getTitle() ) ) {
735741 return true;
736742 }
737743 $action = $wgRequest->getVal( 'action', 'view' );
738744 if( $action == 'protect' || $action == 'unprotect' ) {
739 - # Check for an overridabe revision
740 - $frev = $this->getStableRev();
741 - if( !$frev ) {
742 - return true;
743 - }
744745 wfLoadExtensionMessages( 'FlaggedRevs' );
745746 # Load special page name
746747 wfLoadExtensionMessages( 'Stabilization' );
747748 $title = SpecialPage::getTitleFor( 'Stabilization' );
748749 # Give a link to the page to configure the stable version
749 - $wgOut->prependHTML( "<span class='plainlinks'>" .
750 - wfMsgExt( 'revreview-visibility',array('parseinline'), $title->getPrefixedText() ) .
751 - "</span>" );
 750+ $frev = $this->getStableRev();
 751+ if( $frev && $frev->getRevId() == $this->parent->getLatest() ) {
 752+ $wgOut->prependHTML( "<span class='plainlinks'>" .
 753+ wfMsgExt( 'revreview-visibility',array('parseinline'), $title->getPrefixedText() ) .
 754+ "</span>" );
 755+ } else {
 756+ $wgOut->prependHTML( "<span class='plainlinks'>" .
 757+ wfMsgExt( 'revreview-visibility2',array('parseinline'), $title->getPrefixedText() ) .
 758+ "</span>" );
 759+ }
752760 }
753761 return true;
754762 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -781,8 +781,10 @@
782782 if( !$expiry || $expiry < $now ) {
783783 $row = null;
784784 self::purgeExpiredConfigurations();
 785+ $title->invalidateCache();
785786 }
786 - } else {
 787+ }
 788+ if( !$row ) {
787789 global $wgFlaggedRevsOverride, $wgFlaggedRevsPrecedence;
788790 # Keep this consistent across settings. 1 -> override, 0 -> don't
789791 $override = $wgFlaggedRevsOverride ? 1 : 0;
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -146,7 +146,8 @@
147147 'revreview-update-none' => 'Please [[{{MediaWiki:Validationpage}}|review]] any changes \'\'(shown below)\'\' made since the stable revision was [{{fullurl:Special:Log|type=review&page={{FULLPAGENAMEE}}}} approved].',
148148 'revreview-update-use' => '\'\'\'NOTE:\'\'\' If any of these templates/images have a stable version, then it is already used in the stable version of this page.',
149149 'revreview-diffonly' => '\'\'To review the page, click the "current revision" revision link and use the review form.\'\'',
150 - 'revreview-visibility' => '\'\'\'This page has a [[{{MediaWiki:Validationpage}}|stable version]]; settings for it can be [{{fullurl:Special:Stabilization|page={{FULLPAGENAMEE}}}} configured].\'\'\'',
 150+ 'revreview-visibility' => '\'\'\'This page has an updated [[{{MediaWiki:Validationpage}}|stable version]]; page stability settings can be [{{fullurl:Special:Stabilization|page={{FULLPAGENAMEE}}}} configured].\'\'\'',
 151+ 'revreview-visibility2' => '\'\'\'This page does not have an updated [[{{MediaWiki:Validationpage}}|stable version]]; page stability settings can be [{{fullurl:Special:Stabilization|page={{FULLPAGENAMEE}}}} configured].\'\'\'',
151152 'right-autopatrolother' => 'Automatically mark revisions in non-main namespaces patrolled',
152153 'right-autoreview' => 'Automatically mark revisions as sighted',
153154 'right-movestable' => 'Move stable pages',
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -118,17 +118,8 @@
119119 }
120120
121121 protected static function getLineClass( $hours, $uw ) {
122 - global $wgFlaggedRevsLongPending;
123122 if( !$uw )
124123 return 'fr-unreviewed-unwatched';
125 - # Show variable colors
126 - /*if( $hours > $wgFlaggedRevsLongPending[2] )
127 - return 'fr-pending-long3';
128 - if( $hours > $wgFlaggedRevsLongPending[1] )
129 - return 'fr-pending-long2';
130 - if( $hours > $wgFlaggedRevsLongPending[0] )
131 - return 'fr-pending-long';
132 - */
133124 # Default: none
134125 return "";
135126 }