r60944 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60943‎ | r60944 | r60945 >
Date:21:11, 11 January 2010
Author:aaron
Status:ok
Tags:
Comment:
* Renamed a few functions
* Expanded readme a bit
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/README.txt (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiStabilize.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc
@@ -141,7 +141,7 @@
142142 $db->delete( 'flaggedpage_config',
143143 array( "fpc_page_id BETWEEN $blockStart AND $blockEnd",
144144 'fpc_select' => FlaggedRevs::getPrecedence(),
145 - 'fpc_override' => intval( FlaggedRevs::showStableByDefault() )
 145+ 'fpc_override' => intval( FlaggedRevs::isStableShownByDefault() )
146146 ),
147147 __FUNCTION__
148148 );
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -35,7 +35,7 @@
3636 * Is the stable version shown by default for this page?
3737 * @returns bool
3838 */
39 - public function showStableByDefault() {
 39+ public function isStableShownByDefault() {
4040 # Get page configuration
4141 $config = $this->getVisibilitySettings();
4242 return (bool)$config['override'];
@@ -46,7 +46,7 @@
4747 * @returns bool
4848 */
4949 public function limitedUI() {
50 - return ( FlaggedRevs::forDefaultVersionOnly() && !$this->showStableByDefault() );
 50+ return ( FlaggedRevs::forDefaultVersionOnly() && !$this->isStableShownByDefault() );
5151 }
5252
5353 /**
@@ -54,7 +54,7 @@
5555 * @returns bool
5656 */
5757 public function isPageLocked() {
58 - return ( !FlaggedRevs::showStableByDefault() && $this->showStableByDefault() );
 58+ return ( !FlaggedRevs::isStableShownByDefault() && $this->isStableShownByDefault() );
5959 }
6060
6161 /**
@@ -62,7 +62,7 @@
6363 * @returns bool
6464 */
6565 public function isPageUnlocked() {
66 - return ( FlaggedRevs::showStableByDefault() && !$this->showStableByDefault() );
 66+ return ( FlaggedRevs::isStableShownByDefault() && !$this->isStableShownByDefault() );
6767 }
6868
6969 /**
@@ -71,7 +71,7 @@
7272 */
7373 public function lowProfileUI() {
7474 return FlaggedRevs::lowProfileUI() &&
75 - FlaggedRevs::showStableByDefault() == $this->showStableByDefault();
 75+ FlaggedRevs::isStableShownByDefault() == $this->isStableShownByDefault();
7676 }
7777
7878 /**
@@ -82,7 +82,7 @@
8383 if( !FlaggedRevs::isPageReviewable( $this->getTitle() ) ) {
8484 return false;
8585 } elseif( !$titleOnly && FlaggedRevs::forDefaultVersionOnly()
86 - && !$this->showStableByDefault() )
 86+ && !$this->isStableShownByDefault() )
8787 {
8888 return false;
8989 }
@@ -98,7 +98,7 @@
9999 if( FlaggedRevs::isPagePatrollable( $this->getTitle() ) ) {
100100 return true;
101101 } elseif( !$titleOnly && FlaggedRevs::forDefaultVersionOnly()
102 - && !$this->showStableByDefault() )
 102+ && !$this->isStableShownByDefault() )
103103 {
104104 return true;
105105 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -199,7 +199,7 @@
200200 * Should this user see stable versions by default?
201201 * @returns bool
202202 */
203 - public static function showStableByDefault() {
 203+ public static function isStableShownByDefault() {
204204 global $wgFlaggedRevsOverride;
205205 return (bool)$wgFlaggedRevsOverride;
206206 }
@@ -218,7 +218,7 @@
219219 * @returns bool
220220 */
221221 public static function stableOnlyIfConfigured() {
222 - return self::forDefaultVersionOnly() && !self::showStableByDefault();
 222+ return self::forDefaultVersionOnly() && !self::isStableShownByDefault();
223223 }
224224
225225 /**
@@ -1223,7 +1223,7 @@
12241224 'select' => self::getPrecedence(),
12251225 # Keep this consistent across settings:
12261226 ## 1 -> override, 0 -> don't
1227 - 'override' => self::showStableByDefault() ? 1 : 0,
 1227+ 'override' => self::isStableShownByDefault() ? 1 : 0,
12281228 'autoreview' => '',
12291229 'expiry' => 'infinity'
12301230 );
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -392,7 +392,7 @@
393393 global $wgUser, $wgContLang;
394394 $changed = $reset = false;
395395 $defaultPrecedence = FlaggedRevs::getPrecedence();
396 - $defaultOverride = FlaggedRevs::showStableByDefault();
 396+ $defaultOverride = FlaggedRevs::isStableShownByDefault();
397397 if( $this->select == $defaultPrecedence && $this->override == $defaultOverride )
398398 {
399399 $reset = ($this->autoreview == ''); // we are going back to site defaults
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -70,7 +70,7 @@
7171 FlaggedRevsXML::getLevelMenu( $this->level, 'revreview-filter-stable' ) . '</span> '
7272 : ""
7373 ) .
74 - ( (!FlaggedRevs::showStableByDefault() && !FlaggedRevs::forDefaultVersionOnly()) ?
 74+ ( (!FlaggedRevs::isStableShownByDefault() && !FlaggedRevs::forDefaultVersionOnly()) ?
7575 "<span style='white-space: nowrap;'>" .
7676 Xml::check( 'stable', $this->stable, array( 'id' => 'wpStable' ) ) .
7777 Xml::label( wfMsg('oldreviewed-stable'), 'wpStable' ) . '</span> '
@@ -307,7 +307,7 @@
308308 $this->category = $category ? str_replace(' ','_',$category) : null;
309309 $this->size = ($size !== null) ? intval($size) : null;
310310 $this->watched = (bool)$watched;
311 - $this->stable = $stable && !FlaggedRevs::showStableByDefault()
 311+ $this->stable = $stable && !FlaggedRevs::isStableShownByDefault()
312312 && !FlaggedRevs::forDefaultVersionOnly();
313313 parent::__construct();
314314 // Don't get to expensive
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -175,9 +175,7 @@
176176 * Update flaggedrevs tracking tables
177177 */
178178 public static function onArticleDelete( &$article, &$user, $reason, $id ) {
179 - $dbw = wfGetDB( DB_MASTER );
180 - $dbw->delete( 'flaggedpage_config', array( 'fpc_page_id' => $id ), __METHOD__ );
181 - $dbw->delete( 'flaggedpage_pending', array( 'fpp_page_id' => $id ), __METHOD__ );
 179+ FlaggedRevs::clearTrackingRows( $id );
182180 return true;
183181 }
184182
@@ -720,7 +718,7 @@
721719 return true;
722720 $flaggedArticle = FlaggedArticle::getTitleInstance( $title );
723721 # If the current shows be default anyway, nothing to do...
724 - if( !$flaggedArticle->showStableByDefault() ) {
 722+ if( !$flaggedArticle->isStableShownByDefault() ) {
725723 return true;
726724 }
727725 $frev = $flaggedArticle->getStableRev();
@@ -1638,7 +1636,8 @@
16391637 public static function addToFileHistQuery(
16401638 $file, &$tables, &$fields, &$conds, &$opts, &$join_conds
16411639 ) {
1642 - if( !$file->isLocal() ) return true; // local files only
 1640+ if( !$file->isLocal() )
 1641+ return true; // local files only
16431642 $flaggedArticle = FlaggedArticle::getTitleInstance( $file->getTitle() );
16441643 # Non-content pages cannot be validated. Stable version must exist.
16451644 if( $flaggedArticle->isReviewable() && $flaggedArticle->getStableRev() ) {
@@ -2071,7 +2070,7 @@
20722071 $selected = $wgRequest->getVal( 'mwStabilityConfig' );
20732072 if( $selected == "none" ) {
20742073 $form->select = FlaggedRevs::getPrecedence(); // default
2075 - $form->override = (int)FlaggedRevs::showStableByDefault(); // default
 2074+ $form->override = (int)FlaggedRevs::isStableShownByDefault(); // default
20762075 $form->autoreview = ''; // default
20772076 $form->reviewThis = false;
20782077 } else if( isset($levels[$selected]) ) {
Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php
@@ -73,7 +73,7 @@
7474 $selected = $params['protectlevel'];
7575 if( $selected == "none" ) {
7676 $form->select = FlaggedRevs::getPrecedence(); // default
77 - $form->override = (int)FlaggedRevs::showStableByDefault(); // default
 77+ $form->override = (int)FlaggedRevs::isStableShownByDefault(); // default
7878 $form->autoreview = ''; // default
7979 } else if( isset($levels[$selected]) ) {
8080 $form->select = $levels[$selected]['select'];
Index: trunk/extensions/FlaggedRevs/README.txt
@@ -22,11 +22,27 @@
2323 expains these further.
2424
2525 == Uninstallation ==
26 -* Remove the include line from LocalSettings.php
27 -* Drop the tables in FlaggedRevs.sql. Drop the columns 'page_ext_reviewed', 'page_ext_quality' and 'page_ext_stable',
28 -and the index 'ext_namespace_reviewed' from the page table.
29 -* Run maintenance/refreshLinks.php from the command line to flush out the stable version links
 26+* Remove the FlaggedRevs include line from LocalSettings.php.
 27+* Run maintenance/refreshLinks.php from the command line to flush out the stable version links.
 28+* Drop the tables in FlaggedRevs.sql to free up disk space. You can use the following query:
3029
 30+ -- Replace /*_*/ with the proper DB prefix
 31+ DROP TABLE IF EXISTS /*_*/flaggedpages;
 32+ DROP TABLE IF EXISTS /*_*/flaggedpage_pending;
 33+ DROP TABLE IF EXISTS /*_*/flaggedrevs;
 34+ DROP TABLE IF EXISTS/*_*/flaggedtemplates;
 35+ DROP TABLE IF EXISTS /*_*/flaggedimages;
 36+ DROP TABLE IF EXISTS /*_*/flaggedpage_config;
 37+ DROP TABLE IF EXISTS /*_*/flaggedrevs_tracking;
 38+ DROP TABLE IF EXISTS /*_*/flaggedrevs_promote;
 39+
 40+* If they exist, drop the columns 'page_ext_reviewed', 'page_ext_quality', 'page_ext_stable',
 41+and the index 'ext_namespace_reviewed' from the page table. You can use the following query:
 42+
 43+ -- Replace /*_*/ with the proper DB prefix
 44+ ALTER TABLE /*_*/page DROP INDEX ext_namespace_reviewed;
 45+ ALTER TABLE /*_*/page DROP COLUMN page_ext_reviewed, DROP COLUMN page_ext_quality, DROP COLUMN page_ext_stable;
 46+
3147 == Licensing ==
3248 © GPL, Aaron Schulz, Joerg Baach, 2007
3349
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -88,7 +88,7 @@
8989 * Is this user shown the stable version by default for this page?
9090 * @returns bool
9191 */
92 - public function showStableByDefaultUser() {
 92+ public function isStableShownByDefaultUser() {
9393 $this->load();
9494 $config = $this->article->getVisibilitySettings(); // page configuration
9595 return ( $config['override'] && !FlaggedRevs::ignoreDefaultVersion() );
@@ -98,10 +98,10 @@
9999 * Is this user shown the diff-to-stable on edit for this page?
100100 * @returns bool
101101 */
102 - public function showDiffOnEditUser() {
 102+ public function isDiffShownOnEdit() {
103103 global $wgUser;
104104 $this->load();
105 - return ( $wgUser->isAllowed('review') || $this->showStableByDefaultUser() );
 105+ return ( $wgUser->isAllowed('review') || $this->isStableShownByDefaultUser() );
106106 }
107107
108108 /**
@@ -400,7 +400,7 @@
401401 }
402402 }
403403 # Index the stable version only if it is the default
404 - if( $this->article->showStableByDefault() ) {
 404+ if( $this->article->isStableShownByDefault() ) {
405405 $wgOut->setRobotPolicy( 'noindex,nofollow' );
406406 }
407407 }
@@ -739,7 +739,7 @@
740740 $isOld = ($revId != $latestId); // not the current rev?
741741 # Let new users know about review procedure a tag.
742742 # If the log excerpt was shown this is redundant.
743 - if( !$log && !$wgUser->getId() && $this->article->showStableByDefault() ) {
 743+ if( !$log && !$wgUser->getId() && $this->article->isStableShownByDefault() ) {
744744 $items[] = wfMsgExt( 'revreview-editnotice', array('parseinline') );
745745 }
746746 # Add a notice if there are pending edits...
@@ -750,7 +750,7 @@
751751 # Show diff to stable, to make things less confusing...
752752 # This can be disabled via user preferences
753753 if( $frev->getRevId() < $revId // changes were made
754 - && $this->showDiffOnEditUser() // stable default and user cannot review
 754+ && $this->isDiffShownOnEdit() // stable default and user cannot review
755755 && $wgUser->getBoolOption( 'flaggedrevseditdiffs' ) // not disable via prefs
756756 ) {
757757 # Don't show for old revisions, diff, preview, or undo
@@ -983,7 +983,7 @@
984984 // Set draft tab as needed...
985985 if( !$skin->mTitle->isTalkPage() && !$synced ) {
986986 if( isset( $views['edit'] ) ) {
987 - if( $fa->showStableByDefault() ) {
 987+ if( $fa->isStableShownByDefault() ) {
988988 $views['edit']['text'] = wfMsg('revreview-edit');
989989 }
990990 if( $this->pageOverride() ) {
@@ -991,7 +991,7 @@
992992 }
993993 }
994994 if( isset( $views['viewsource'] ) ) {
995 - if( $fa->showStableByDefault() ) {
 995+ if( $fa->isStableShownByDefault() ) {
996996 $views['viewsource']['text'] = wfMsg('revreview-source');
997997 }
998998 if( $this->pageOverride() ) {
@@ -1358,7 +1358,7 @@
13591359 } else {
13601360 if( $frev && $latest != $frev->getRevId() ) {
13611361 $extraQuery .= "stable=0";
1362 - if( !$wgUser->isAllowed('review') && $this->article->showStableByDefault() ) {
 1362+ if( !$wgUser->isAllowed('review') && $this->article->isStableShownByDefault() ) {
13631363 $extraQuery .= "&shownotice=1";
13641364 }
13651365 }
@@ -1487,7 +1487,7 @@
14881488 $form .= Xml::closeElement( 'legend' ) . "\n";
14891489 # Show explanatory text
14901490 if( !FlaggedRevs::lowProfileUI() ) {
1491 - $msg = FlaggedRevs::showStableByDefault() ? 'revreview-text' : 'revreview-text2';
 1491+ $msg = FlaggedRevs::isStableShownByDefault() ? 'revreview-text' : 'revreview-text2';
14921492 $form .= wfMsgExt( $msg, array('parse') );
14931493 }
14941494

Status & tagging log