r78514 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78513‎ | r78514 | r78515 >
Date:20:53, 16 December 2010
Author:aaron
Status:ok
Tags:
Comment:
Indentation cleanup
Modified paths:
  • /trunk/extensions/FlaggedRevs/FRDependencyUpdate.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FRExtraCacheUpdate.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FRUserCounters.php (modified) (history)
  • /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/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ConfiguredPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ReviewedVersions_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FRUserCounters.php
@@ -3,7 +3,7 @@
44 * Class containing utility functions for per-user stats
55 */
66 class FRUserCounters {
7 - /**
 7+ /**
88 * Get params for a user
99 * @param int $uid
1010 * @param int $flags FR_MASTER, FR_FOR_UPDATE
@@ -20,7 +20,7 @@
2121 return $p;
2222 }
2323
24 - /**
 24+ /**
2525 * Initializes unset param fields to their starting values
2626 * @param &array $p
2727 */
@@ -39,7 +39,7 @@
4040 }
4141 }
4242
43 - /**
 43+ /**
4444 * Get the params row for a user
4545 * @param int $uid
4646 * @param int $flags FR_MASTER, FR_FOR_UPDATE
@@ -62,7 +62,7 @@
6363 );
6464 }
6565
66 - /**
 66+ /**
6767 * Save params for a user
6868 * @param int $uid
6969 * @param array $params
@@ -80,7 +80,7 @@
8181 return ( $dbw->affectedRows() > 0 );
8282 }
8383
84 - /**
 84+ /**
8585 * Flatten params for a user for DB storage
8686 * Note: param values must be integers
8787 * @param array $params
@@ -126,7 +126,7 @@
127127 return $p;
128128 }
129129
130 - /**
 130+ /**
131131 * Update users params array for a user on edit
132132 * @param &array $p user params
133133 * @param Article $article the article just edited
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -51,7 +51,7 @@
5252 define( 'FR_INCLUDES_FREEZE', 1 );
5353 if ( !defined( 'FR_INCLUDES_STABLE' ) )
5454 define( 'FR_INCLUDES_STABLE', 2 );
55 -
 55+
5656 $wgExtensionCredits['specialpage'][] = array(
5757 'path' => __FILE__,
5858 'name' => 'Flagged Revisions',
@@ -615,4 +615,3 @@
616616
617617 # B/C ...
618618 $wgLogActions['rights/erevoke'] = 'rights-editor-revoke';
619 -
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -77,7 +77,7 @@
7878
7979 /**
8080 * Is the stable version shown by default for this page?
81 - * @param int $flags, FR_MASTER
 81+ * @param int $flags, FR_MASTER
8282 * @return bool
8383 */
8484 public function isStableShownByDefault( $flags = 0 ) {
@@ -88,7 +88,7 @@
8989
9090 /**
9191 * Do edits have to be reviewed before being shown by default (going live)?
92 - * @param int $flags, FR_MASTER
 92+ * @param int $flags, FR_MASTER
9393 * @return bool
9494 */
9595 public function editsRequireReview( $flags = 0 ) {
@@ -101,7 +101,7 @@
102102
103103 /**
104104 * Are edits to this page currently pending?
105 - * @param int $flags, FR_MASTER
 105+ * @param int $flags, FR_MASTER
106106 * @return bool
107107 */
108108 public function revsArePending( $flags = 0 ) {
@@ -249,27 +249,27 @@
250250
251251 /**
252252 * Is this article reviewable?
253 - * @param int $flags, FR_MASTER
254 - * @return bool
 253+ * @param int $flags, FR_MASTER
 254+ * @return bool
255255 */
256256 public function isReviewable( $flags = 0 ) {
257257 if ( !FlaggedRevs::inReviewNamespace( $this->getTitle() ) ) {
258258 return false;
259259 }
260 - return !( FlaggedRevs::useOnlyIfProtected()
261 - && !$this->isStableShownByDefault( $flags ) );
 260+ return !( FlaggedRevs::useOnlyIfProtected()
 261+ && !$this->isStableShownByDefault( $flags ) );
262262 }
263263
264264 /**
265265 * Is this page in patrollable?
266 - * @param int $flags, FR_MASTER
 266+ * @param int $flags, FR_MASTER
267267 * @return bool
268268 */
269269 public function isPatrollable( $flags = 0 ) {
270 - if ( !FlaggedRevs::inPatrolNamespace( $this->getTitle() ) ) {
 270+ if ( !FlaggedRevs::inPatrolNamespace( $this->getTitle() ) ) {
271271 return false;
272 - }
273 - return !$this->isReviewable( $flags ); // pages that are reviewable are not patrollable
 272+ }
 273+ return !$this->isReviewable( $flags ); // pages that are reviewable are not patrollable
274274 }
275275
276276 /**
@@ -283,7 +283,7 @@
284284 $srev = FlaggedRevision::newFromStable( $this->getTitle(), $flags );
285285 $this->stableRev = $srev ? $srev : false; // false => "found nothing"
286286 }
287 - if ( $this->stableRev ) {
 287+ if ( $this->stableRev ) {
288288 return $this->stableRev;
289289 }
290290 return null;
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -517,7 +517,7 @@
518518 if ( $resetManager ) {
519519 $incManager->clear(); // reset the FRInclusionManager as needed
520520 }
521 - return $parserOut;
 521+ return $parserOut;
522522 }
523523
524524 /**
@@ -647,7 +647,7 @@
648648
649649 # ################ Tracking/cache update update functions #################
650650
651 - /**
 651+ /**
652652 * Update the page tables with a new stable version.
653653 * @param Title $title
654654 * @param mixed $sv, the new stable version (optional)
@@ -691,7 +691,7 @@
692692 return $changed;
693693 }
694694
695 - /**
 695+ /**
696696 * @param Title $title
697697 * Updates squid cache for a title. Defers till after main commit().
698698 */
@@ -700,7 +700,7 @@
701701 $wgDeferredUpdateList[] = new FRSquidUpdate( $title );
702702 }
703703
704 - /**
 704+ /**
705705 * @param Article $article
706706 * @param Revision $rev, the new stable version
707707 * @param mixed $latest, the latest rev ID (optional)
@@ -761,7 +761,7 @@
762762 return true;
763763 }
764764
765 - /**
 765+ /**
766766 * @param Article $article
767767 * @param mixed $latest, the latest rev ID (optional)
768768 * Updates the flaggedpage_pending table
@@ -830,7 +830,7 @@
831831 $dbw->insert( 'flaggedpage_pending', $data, __METHOD__ );
832832 }
833833
834 - /**
 834+ /**
835835 * Do cache updates for when the stable version of a page changed.
836836 * Invalidates/purges pages that include the given page.
837837 * @param Title $title
@@ -846,7 +846,7 @@
847847 $wgDeferredUpdateList[] = new FRExtraCacheUpdate( $title );
848848 }
849849
850 - /**
 850+ /**
851851 * Invalidates/purges pages where only stable version includes this page.
852852 * @param Title $title
853853 */
@@ -1267,7 +1267,7 @@
12681268 return ( in_array( $ns, $namespaces ) );
12691269 }
12701270
1271 - /**
 1271+ /**
12721272 * Clear FlaggedRevs tracking tables for this page
12731273 * @param mixed $pageId (int or array)
12741274 */
@@ -1278,7 +1278,7 @@
12791279 $dbw->delete( 'flaggedpage_pending', array( 'fpp_page_id' => $pageId ), __METHOD__ );
12801280 }
12811281
1282 - /**
 1282+ /**
12831283 * Clear tracking table of stable-only links for this page
12841284 * @param mixed $pageId (int or array)
12851285 */
Index: trunk/extensions/FlaggedRevs/FRExtraCacheUpdate.php
@@ -9,15 +9,15 @@
1010 */
1111 class FRExtraCacheUpdate {
1212 public $mTitle, $mTable;
13 - public $mRowsPerJob, $mRowsPerQuery;
 13+ public $mRowsPerJob, $mRowsPerQuery;
1414
15 - public function __construct( Title $titleTo ) {
16 - global $wgUpdateRowsPerJob, $wgUpdateRowsPerQuery;
17 - $this->mTitle = $titleTo;
18 - $this->mTable = 'flaggedrevs_tracking';
19 - $this->mRowsPerJob = $wgUpdateRowsPerJob;
20 - $this->mRowsPerQuery = $wgUpdateRowsPerQuery;
21 - }
 15+ public function __construct( Title $titleTo ) {
 16+ global $wgUpdateRowsPerJob, $wgUpdateRowsPerQuery;
 17+ $this->mTitle = $titleTo;
 18+ $this->mTable = 'flaggedrevs_tracking';
 19+ $this->mRowsPerJob = $wgUpdateRowsPerJob;
 20+ $this->mRowsPerQuery = $wgUpdateRowsPerQuery;
 21+ }
2222
2323 public function doUpdate() {
2424 # Fetch the IDs
@@ -60,7 +60,7 @@
6161 $id = false;
6262 break;
6363 }
64 - }
 64+ }
6565 # Insert batch into the queue if there is anything there
6666 if ( $first ) {
6767 $params = array(
@@ -70,10 +70,10 @@
7171 );
7272 $jobs[] = new FRExtraCacheUpdateJob( $this->mTitle, $params );
7373 }
74 - $start = $id; // Where the last ID left off
 74+ $start = $id; // Where the last ID left off
7575 } while ( $start );
7676 Job::batchInsert( $jobs );
77 - }
 77+ }
7878
7979 public function getFromField() {
8080 return 'ftr_from';
@@ -85,49 +85,49 @@
8686 }
8787
8888 /**
89 - * Invalidate a set of IDs, right now
90 - */
91 - public function invalidateIDs( ResultWrapper $res ) {
92 - global $wgUseFileCache, $wgUseSquid;
93 - if ( $res->numRows() == 0 ) return; // sanity check
 89+ * Invalidate a set of IDs, right now
 90+ */
 91+ public function invalidateIDs( ResultWrapper $res ) {
 92+ global $wgUseFileCache, $wgUseSquid;
 93+ if ( $res->numRows() == 0 ) return; // sanity check
9494
95 - $dbw = wfGetDB( DB_MASTER );
96 - $timestamp = $dbw->timestamp();
97 - $done = false;
 95+ $dbw = wfGetDB( DB_MASTER );
 96+ $timestamp = $dbw->timestamp();
 97+ $done = false;
9898
99 - while ( !$done ) {
100 - # Get all IDs in this query into an array
101 - $ids = array();
102 - for ( $i = 0; $i < $this->mRowsPerQuery; $i++ ) {
103 - $row = $res->fetchRow();
104 - if ( $row ) {
105 - $ids[] = $row[0];
106 - } else {
107 - $done = true;
108 - break;
109 - }
110 - }
111 - if ( count( $ids ) == 0 ) break;
112 - # Update page_touched
113 - $dbw->update( 'page', array( 'page_touched' => $timestamp ),
 99+ while ( !$done ) {
 100+ # Get all IDs in this query into an array
 101+ $ids = array();
 102+ for ( $i = 0; $i < $this->mRowsPerQuery; $i++ ) {
 103+ $row = $res->fetchRow();
 104+ if ( $row ) {
 105+ $ids[] = $row[0];
 106+ } else {
 107+ $done = true;
 108+ break;
 109+ }
 110+ }
 111+ if ( count( $ids ) == 0 ) break;
 112+ # Update page_touched
 113+ $dbw->update( 'page', array( 'page_touched' => $timestamp ),
114114 array( 'page_id' => $ids ), __METHOD__ );
115 - # Update static caches
116 - if ( $wgUseSquid || $wgUseFileCache ) {
117 - $titles = Title::newFromIDs( $ids );
 115+ # Update static caches
 116+ if ( $wgUseSquid || $wgUseFileCache ) {
 117+ $titles = Title::newFromIDs( $ids );
118118 # Update squid cache
119 - if ( $wgUseSquid ) {
120 - $u = SquidUpdate::newFromTitles( $titles );
121 - $u->doUpdate();
122 - }
123 - # Update file cache
124 - if ( $wgUseFileCache ) {
125 - foreach ( $titles as $title ) {
126 - HTMLFileCache::clearFileCache( $title );
127 - }
128 - }
129 - }
130 - }
131 - }
 119+ if ( $wgUseSquid ) {
 120+ $u = SquidUpdate::newFromTitles( $titles );
 121+ $u->doUpdate();
 122+ }
 123+ # Update file cache
 124+ if ( $wgUseFileCache ) {
 125+ foreach ( $titles as $title ) {
 126+ HTMLFileCache::clearFileCache( $title );
 127+ }
 128+ }
 129+ }
 130+ }
 131+ }
132132 }
133133
134134 /**
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php
@@ -23,12 +23,12 @@
2424 private $mTitle;
2525 private $mPageId;
2626 private $mRevId;
27 - private $mStableTemplates;
28 - private $mStableFiles;
 27+ private $mStableTemplates;
 28+ private $mStableFiles;
2929
3030 /**
3131 * @param mixed $row (DB row or array)
32 - * @return void
 32+ * @return void
3333 */
3434 public function __construct( $row ) {
3535 if ( is_object( $row ) ) {
@@ -66,27 +66,27 @@
6767 # Optional fields
6868 $this->mFlags = isset( $row['flags'] ) ?
6969 explode( ',', $row['flags'] ) : null;
70 - $this->mTemplates = isset( $row['templateVersions'] ) ?
71 - $row['templateVersions'] : null;
72 - $this->mFiles = isset( $row['fileVersions'] ) ?
73 - $row['fileVersions'] : null;
 70+ $this->mTemplates = isset( $row['templateVersions'] ) ?
 71+ $row['templateVersions'] : null;
 72+ $this->mFiles = isset( $row['fileVersions'] ) ?
 73+ $row['fileVersions'] : null;
7474 } else {
7575 throw new MWException( 'FlaggedRevision constructor passed invalid row format.' );
7676 }
7777 }
7878
7979 /**
80 - * Get a FlaggedRevision for a title and rev ID.
81 - * Note: will return NULL if the revision is deleted.
 80+ * Get a FlaggedRevision for a title and rev ID.
 81+ * Note: will return NULL if the revision is deleted.
8282 * @param Title $title
8383 * @param int $revId
8484 * @param int $flags FR_MASTER
8585 * @return mixed FlaggedRevision (null on failure)
8686 */
8787 public static function newFromTitle( Title $title, $revId, $flags = 0 ) {
88 - if ( !FlaggedRevs::inReviewNamespace( $title ) ) {
89 - return null; // short-circuit
90 - }
 88+ if ( !FlaggedRevs::inReviewNamespace( $title ) ) {
 89+ return null; // short-circuit
 90+ }
9191 $columns = self::selectFields();
9292 $options = array();
9393 # User master/slave as appropriate
@@ -123,16 +123,16 @@
124124 }
125125
126126 /**
127 - * Get a FlaggedRevision of the stable version of a title.
 127+ * Get a FlaggedRevision of the stable version of a title.
128128 * @param Title $title, page title
129129 * @param int $flags FR_MASTER
130130 * @return mixed FlaggedRevision (null on failure)
131131 */
132132 public static function newFromStable( Title $title, $flags = 0 ) {
133133 if ( !FlaggedRevs::inReviewNamespace( $title ) ) {
134 - return null; // short-circuit
135 - }
136 - $columns = self::selectFields();
 134+ return null; // short-circuit
 135+ }
 136+ $columns = self::selectFields();
137137 $options = array();
138138 $pageId = $title->getArticleID( $flags & FR_MASTER ? Title::GAID_FOR_UPDATE : 0 );
139139 if ( !$pageId ) {
@@ -165,11 +165,11 @@
166166 }
167167
168168 /**
169 - * Get a FlaggedRevision of the stable version of a title.
 169+ * Get a FlaggedRevision of the stable version of a title.
170170 * Skips tracking tables to figure out new stable version.
171171 * @param Title $title, page title
172172 * @param int $flags FR_MASTER
173 - * @param array $config, optional page config (use to skip queries)
 173+ * @param array $config, optional page config (use to skip queries)
174174 * @param string $precedence (latest,quality,pristine)
175175 * @return mixed FlaggedRevision (null on failure)
176176 */
@@ -177,9 +177,9 @@
178178 Title $title, $flags = 0, $config = array(), $precedence = 'latest'
179179 ) {
180180 if ( !FlaggedRevs::inReviewNamespace( $title ) ) {
181 - return null; // short-circuit
182 - }
183 - $columns = self::selectFields();
 181+ return null; // short-circuit
 182+ }
 183+ $columns = self::selectFields();
184184 $options = array();
185185 $pageId = $title->getArticleID( $flags & FR_FOR_UPDATE ? Title::GAID_FOR_UPDATE : 0 );
186186 if ( !$pageId ) {
@@ -193,9 +193,9 @@
194194 $db = wfGetDB( DB_SLAVE );
195195 }
196196 # Get visiblity settings...
197 - if ( empty( $config ) ) {
198 - $config = FlaggedRevs::getPageVisibilitySettings( $title, $flags );
199 - }
 197+ if ( empty( $config ) ) {
 198+ $config = FlaggedRevs::getPageVisibilitySettings( $title, $flags );
 199+ }
200200 if ( !$config['override'] && FlaggedRevs::useOnlyIfProtected() ) {
201201 return null; // page is not reviewable; no stable version
202202 }
@@ -268,13 +268,13 @@
269269 * @return bool success
270270 */
271271 public function insertOn( $auto = false ) {
272 - $dbw = wfGetDB( DB_MASTER );
273 - # Set any text flags
274 - $textFlags = 'dynamic';
 272+ $dbw = wfGetDB( DB_MASTER );
 273+ # Set any text flags
 274+ $textFlags = 'dynamic';
275275 if ( $auto ) $textFlags .= ',auto';
276276 $this->mFlags = explode( ',', $textFlags );
277 - # Build the inclusion data chunks
278 - $tmpInsertRows = array();
 277+ # Build the inclusion data chunks
 278+ $tmpInsertRows = array();
279279 foreach ( $this->getTemplateVersions() as $namespace => $titleAndID ) {
280280 foreach ( $titleAndID as $dbkey => $id ) {
281281 $tmpInsertRows[] = array(
@@ -315,14 +315,14 @@
316316 array( array( 'fr_page_id', 'fr_rev_id' ) ), $revRow, __METHOD__ );
317317 # Clear out any previous garbage...
318318 $dbw->delete( 'flaggedtemplates',
319 - array( 'ft_rev_id' => $this->getRevId() ), __METHOD__ );
 319+ array( 'ft_rev_id' => $this->getRevId() ), __METHOD__ );
320320 # ...and insert template version data
321321 if ( $tmpInsertRows ) {
322322 $dbw->insert( 'flaggedtemplates', $tmpInsertRows, __METHOD__, 'IGNORE' );
323323 }
324324 # Clear out any previous garbage...
325325 $dbw->delete( 'flaggedimages',
326 - array( 'fi_rev_id' => $this->getRevId() ), __METHOD__ );
 326+ array( 'fi_rev_id' => $this->getRevId() ), __METHOD__ );
327327 # ...and insert file version data
328328 if ( $fileInsertRows ) {
329329 $dbw->insert( 'flaggedimages', $fileInsertRows, __METHOD__, 'IGNORE' );
@@ -336,7 +336,7 @@
337337 protected static function selectFields() {
338338 return array(
339339 'fr_rev_id', 'fr_page_id', 'fr_user', 'fr_timestamp',
340 - 'fr_comment', 'fr_quality', 'fr_tags', 'fr_img_name',
 340+ 'fr_comment', 'fr_quality', 'fr_tags', 'fr_img_name',
341341 'fr_img_sha1', 'fr_img_timestamp', 'fr_flags'
342342 );
343343 }
@@ -460,7 +460,7 @@
461461 }
462462
463463 /**
464 - * @param User $user
 464+ * @param User $user
465465 * @return bool
466466 */
467467 public function userCanSetFlags( $user ) {
@@ -471,7 +471,7 @@
472472 * Get original template versions at time of review
473473 * @param int $flags FR_MASTER
474474 * @return Array template versions (ns -> dbKey -> rev Id)
475 - * Note: 0 used for template rev Id if it didn't exist
 475+ * Note: 0 used for template rev Id if it didn't exist
476476 */
477477 public function getTemplateVersions( $flags = 0 ) {
478478 if ( $this->mTemplates == null ) {
@@ -479,7 +479,7 @@
480480 $db = ( $flags & FR_MASTER ) ?
481481 wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
482482 $res = $db->select( 'flaggedtemplates',
483 - array( 'ft_namespace', 'ft_title', 'ft_tmp_rev_id' ),
 483+ array( 'ft_namespace', 'ft_title', 'ft_tmp_rev_id' ),
484484 array( 'ft_rev_id' => $this->getRevId() ),
485485 __METHOD__
486486 );
@@ -497,7 +497,7 @@
498498 * Get original template versions at time of review
499499 * @param int $flags FR_MASTER
500500 * @return Array file versions (dbKey => array('ts' => MW timestamp,'sha1' => sha1) )
501 - * Note: '0' used for file timestamp if it didn't exist ('' for sha1)
 501+ * Note: '0' used for file timestamp if it didn't exist ('' for sha1)
502502 */
503503 public function getFileVersions( $flags = 0 ) {
504504 if ( $this->mFiles == null ) {
@@ -505,16 +505,16 @@
506506 $db = ( $flags & FR_MASTER ) ?
507507 wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
508508 $res = $db->select( 'flaggedimages',
509 - array( 'fi_name', 'fi_img_timestamp', 'fi_img_sha1' ),
 509+ array( 'fi_name', 'fi_img_timestamp', 'fi_img_sha1' ),
510510 array( 'fi_rev_id' => $this->getRevId() ),
511511 __METHOD__
512512 );
513513 foreach ( $res as $row ) {
514 - $reviewedTS = trim( $row->fi_img_timestamp ); // may be ''/NULL
515 - $reviewedTS = $reviewedTS ? wfTimestamp( TS_MW, $reviewedTS ) : '0';
 514+ $reviewedTS = trim( $row->fi_img_timestamp ); // may be ''/NULL
 515+ $reviewedTS = $reviewedTS ? wfTimestamp( TS_MW, $reviewedTS ) : '0';
516516 $this->mFiles[$row->fi_name] = array();
517 - $this->mFiles[$row->fi_name]['ts'] = $reviewedTS;
518 - $this->mFiles[$row->fi_name]['sha1'] = $row->fi_img_sha1;
 517+ $this->mFiles[$row->fi_name]['ts'] = $reviewedTS;
 518+ $this->mFiles[$row->fi_name]['sha1'] = $row->fi_img_sha1;
519519 }
520520 }
521521 return $this->mFiles;
@@ -524,7 +524,7 @@
525525 * Get the current stable version of the templates used at time of review
526526 * @param int $flags FR_MASTER
527527 * @return Array template versions (ns -> dbKey -> rev Id)
528 - * Note: 0 used for template rev Id if it doesn't exist
 528+ * Note: 0 used for template rev Id if it doesn't exist
529529 */
530530 public function getStableTemplateVersions( $flags = 0 ) {
531531 if ( $this->mStableTemplates == null ) {
@@ -532,22 +532,22 @@
533533 $db = ( $flags & FR_MASTER ) ?
534534 wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
535535 $res = $db->select(
536 - array( 'flaggedtemplates', 'page', 'flaggedpages' ),
537 - array( 'ft_namespace', 'ft_title', 'fp_stable' ),
 536+ array( 'flaggedtemplates', 'page', 'flaggedpages' ),
 537+ array( 'ft_namespace', 'ft_title', 'fp_stable' ),
538538 array( 'ft_rev_id' => $this->getRevId() ),
539539 __METHOD__,
540 - array(),
541 - array(
542 - 'page' => array( 'LEFT JOIN',
543 - 'page_namespace = ft_namespace AND page_title = ft_title'),
544 - 'flaggedpages' => array( 'LEFT JOIN', 'fp_page_id = page_id' )
545 - )
 540+ array(),
 541+ array(
 542+ 'page' => array( 'LEFT JOIN',
 543+ 'page_namespace = ft_namespace AND page_title = ft_title'),
 544+ 'flaggedpages' => array( 'LEFT JOIN', 'fp_page_id = page_id' )
 545+ )
546546 );
547547 foreach ( $res as $row ) {
548548 if ( !isset( $this->mStableTemplates[$row->ft_namespace] ) ) {
549549 $this->mStableTemplates[$row->ft_namespace] = array();
550550 }
551 - $revId = (int)$row->fp_stable; // 0 => none
 551+ $revId = (int)$row->fp_stable; // 0 => none
552552 $this->mStableTemplates[$row->ft_namespace][$row->ft_title] = $revId;
553553 }
554554 }
@@ -558,7 +558,7 @@
559559 * Get the current stable version of the files used at time of review
560560 * @param int $flags FR_MASTER
561561 * @return Array file versions (dbKey => array('ts' => MW timestamp,'sha1' => sha1) )
562 - * Note: '0' used for file timestamp if it doesn't exist ('' for sha1)
 562+ * Note: '0' used for file timestamp if it doesn't exist ('' for sha1)
563563 */
564564 public function getStableFileVersions( $flags = 0 ) {
565565 if ( $this->mStableFiles == null ) {
@@ -577,7 +577,7 @@
578578 'flaggedpages' => array( 'LEFT JOIN', 'fp_page_id = page_id' ),
579579 'flaggedrevs' => array( 'LEFT JOIN',
580580 'fr_page_id = fp_page_id AND fr_rev_id = fp_stable' )
581 - )
 581+ )
582582 );
583583 foreach ( $res as $row ) {
584584 $reviewedTS = '0';
@@ -613,13 +613,13 @@
614614 return array(); // short-circuit
615615 }
616616 $dbr = wfGetDB( DB_SLAVE );
617 - # Only get templates with stable or "review time" versions.
618 - # Note: ft_tmp_rev_id is nullable (for deadlinks), so use ft_title
619 - if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) {
620 - $reviewed = "ft_title IS NOT NULL OR fp_stable IS NOT NULL";
621 - } else {
622 - $reviewed = "ft_title IS NOT NULL";
623 - }
 617+ # Only get templates with stable or "review time" versions.
 618+ # Note: ft_tmp_rev_id is nullable (for deadlinks), so use ft_title
 619+ if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) {
 620+ $reviewed = "ft_title IS NOT NULL OR fp_stable IS NOT NULL";
 621+ } else {
 622+ $reviewed = "ft_title IS NOT NULL";
 623+ }
624624 $ret = $dbr->select(
625625 array( 'templatelinks', 'flaggedtemplates', 'page', 'flaggedpages' ),
626626 array( 'tl_namespace', 'tl_title', 'fp_stable', 'ft_tmp_rev_id', 'page_latest' ),
@@ -665,7 +665,7 @@
666666
667667 /*
668668 * Fetch pending file changes for this reviewed page version.
669 - * For each file, the "version used" (for stable parsing) is:
 669+ * For each file, the "version used" (for stable parsing) is:
670670 * (a) (the latest rev) if FR_INCLUDES_CURRENT. Might be non-existing.
671671 * (b) newest( stable rev, rev at time of review ) if FR_INCLUDES_STABLE
672672 * (c) ( rev at time of review ) if FR_INCLUDES_FREEZE
@@ -683,13 +683,13 @@
684684 return array(); // short-circuit
685685 }
686686 $dbr = wfGetDB( DB_SLAVE );
687 - # Only get templates with stable or "review time" versions.
688 - # Note: fi_img_timestamp is nullable (for deadlinks), so use fi_name
689 - if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) {
690 - $reviewed = "fi_name IS NOT NULL OR fr_img_timestamp IS NOT NULL";
691 - } else {
692 - $reviewed = "fi_name IS NOT NULL";
693 - }
 687+ # Only get templates with stable or "review time" versions.
 688+ # Note: fi_img_timestamp is nullable (for deadlinks), so use fi_name
 689+ if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) {
 690+ $reviewed = "fi_name IS NOT NULL OR fr_img_timestamp IS NOT NULL";
 691+ } else {
 692+ $reviewed = "fi_name IS NOT NULL";
 693+ }
694694 $ret = $dbr->select(
695695 array( 'imagelinks', 'flaggedimages', 'page', 'flaggedpages', 'flaggedrevs' ),
696696 array( 'il_to', 'fi_img_timestamp', 'fr_img_timestamp' ),
@@ -704,34 +704,34 @@
705705 'flaggedpages' => array( 'LEFT JOIN', 'fp_page_id = page_id' ),
706706 'flaggedrevs' => array( 'LEFT JOIN',
707707 'fr_page_id = fp_page_id AND fr_rev_id = fp_stable' )
708 - )
 708+ )
709709 );
710710 $fileChanges = array();
711711 foreach ( $ret as $row ) {
712712 $title = Title::makeTitleSafe( NS_FILE, $row->il_to );
713713 $reviewedTS = trim( $row->fi_img_timestamp ); // may be ''/NULL
714 - $reviewedTS = $reviewedTS ? wfTimestamp( TS_MW, $reviewedTS ) : null;
 714+ $reviewedTS = $reviewedTS ? wfTimestamp( TS_MW, $reviewedTS ) : null;
715715 if ( FlaggedRevs::inclusionSetting() == FR_INCLUDES_STABLE ) {
716716 $stableTS = wfTimestampOrNull( TS_MW, $row->fr_img_timestamp );
717 - # Select newest of (stable rev, rev when reviewed) as "version used"
 717+ # Select newest of (stable rev, rev when reviewed) as "version used"
718718 $tsStable = ( $stableTS >= $reviewedTS )
719 - ? $stableTS
720 - : $reviewedTS;
 719+ ? $stableTS
 720+ : $reviewedTS;
721721 } else {
722722 $tsStable = $reviewedTS;
723723 }
724724 # Compare to current...
725725 $file = wfFindFile( $title ); // current file version
726726 if ( $file ) { // file exists
727 - if ( $noForeign === 'noForeign' && !$file->isLocal() ) {
728 - $updated = !$tsStable; // created (ignore new versions)
729 - } else {
730 - $updated = ( $file->getTimestamp() > $tsStable ); // edited/created
731 - }
732 - $deleted = false;
 727+ if ( $noForeign === 'noForeign' && !$file->isLocal() ) {
 728+ $updated = !$tsStable; // created (ignore new versions)
 729+ } else {
 730+ $updated = ( $file->getTimestamp() > $tsStable ); // edited/created
 731+ }
 732+ $deleted = false;
733733 } else { // file doesn't exists
734734 $updated = false;
735 - $deleted = (bool)$tsStable; // later deleted
 735+ $deleted = (bool)$tsStable; // later deleted
736736 }
737737 if ( $deleted || $updated ) {
738738 $fileChanges[] = array( $title, $tsStable );
Index: trunk/extensions/FlaggedRevs/FRDependencyUpdate.php
@@ -11,14 +11,14 @@
1212 protected $sCategories;
1313 protected $dbw;
1414
15 - public function __construct( Title $title, ParserOutput $stableOutput ) {
 15+ public function __construct( Title $title, ParserOutput $stableOutput ) {
1616 $this->title = $title;
1717 # Stable version links
1818 $this->sLinks = $stableOutput->getLinks();
1919 $this->sTemplates = $stableOutput->getTemplates();
2020 $this->sImages = $stableOutput->getImages();
2121 $this->sCategories = $stableOutput->getCategories();
22 - }
 22+ }
2323
2424 public function doUpdate() {
2525 $deps = array();
@@ -50,10 +50,10 @@
5151 # Get any categories that are only in the stable version...
5252 $cCategories = $this->getCurrentVersionCategories();
5353 foreach ( $this->sCategories as $category => $sort ) {
54 - if ( !isset( $cCategories[$category] ) ) {
 54+ if ( !isset( $cCategories[$category] ) ) {
5555 self::addDependency( $deps, NS_CATEGORY, $category );
5656 }
57 - }
 57+ }
5858 # Get any dependency tracking changes
5959 $existing = $this->getExistingDeps();
6060 # Do incremental updates...
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -14,7 +14,7 @@
1515 global $wgUser;
1616 parent::__construct( 'Stabilization', 'stablesettings' );
1717 $this->skin = $wgUser->getSkin();
18 - }
 18+ }
1919
2020 public function execute( $par ) {
2121 global $wgRequest, $wgUser, $wgOut;
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php
@@ -11,12 +11,12 @@
1212 private $form;
1313 private $page;
1414
15 - public function __construct() {
 15+ public function __construct() {
1616 parent::__construct( 'RevisionReview', 'review' );
17 - }
 17+ }
1818
19 - public function execute( $par ) {
20 - global $wgRequest, $wgUser, $wgOut;
 19+ public function execute( $par ) {
 20+ global $wgRequest, $wgUser, $wgOut;
2121 $confirmed = $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
2222 if ( $wgUser->isAllowed( 'review' ) ) {
2323 if ( $wgUser->isBlocked( !$confirmed ) ) {
Index: trunk/extensions/FlaggedRevs/specialpages/QualityOversight_body.php
@@ -6,11 +6,11 @@
77
88 class QualityOversight extends SpecialPage
99 {
10 - public function __construct() {
11 - parent::__construct( 'QualityOversight' );
12 - }
 10+ public function __construct() {
 11+ parent::__construct( 'QualityOversight' );
 12+ }
1313
14 - public function execute( $par ) {
 14+ public function execute( $par ) {
1515 global $wgOut, $wgUser, $wgRequest, $wgFlaggedRevsOversightAge;
1616
1717 $this->setHeaders();
Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedVersions_body.php
@@ -6,12 +6,12 @@
77
88 class ReviewedVersions extends UnlistedSpecialPage
99 {
10 - public function __construct() {
11 - parent::__construct( 'ReviewedVersions' );
12 - }
 10+ public function __construct() {
 11+ parent::__construct( 'ReviewedVersions' );
 12+ }
1313
14 - public function execute( $par ) {
15 - global $wgRequest, $wgUser, $wgOut;
 14+ public function execute( $par ) {
 15+ global $wgRequest, $wgUser, $wgOut;
1616
1717 $this->setHeaders();
1818 $this->skin = $wgUser->getSkin();
@@ -59,8 +59,8 @@
6060 $ftime = $wgLang->time( wfTimestamp( TS_MW, $row->fr_timestamp ), true );
6161 $review = wfMsgExt( 'reviewedversions-review', array( 'parseinline', 'replaceafter' ),
6262 $fdatim,
63 - $this->skin->userLink( $row->fr_user, $row->user_name ) .
64 - ' ' . $this->skin->userToolLinks( $row->fr_user, $row->user_name ),
 63+ $this->skin->userLink( $row->fr_user, $row->user_name ) .
 64+ ' ' . $this->skin->userToolLinks( $row->fr_user, $row->user_name ),
6565 $fdate, $ftime, $row->user_name
6666 );
6767 $lev = ( $row->fr_quality >= 1 )
Index: trunk/extensions/FlaggedRevs/specialpages/ConfiguredPages_body.php
@@ -8,11 +8,11 @@
99 class ConfiguredPages extends SpecialPage
1010 {
1111 public function __construct() {
12 - parent::__construct( 'ConfiguredPages' );
13 - }
 12+ parent::__construct( 'ConfiguredPages' );
 13+ }
1414
1515 public function execute( $par ) {
16 - global $wgRequest, $wgUser;
 16+ global $wgRequest, $wgUser;
1717
1818 $this->setHeaders();
1919 $this->skin = $wgUser->getSkin();
Index: trunk/extensions/FlaggedRevs/specialpages/ReviewedPages_body.php
@@ -8,7 +8,7 @@
99 {
1010 public function __construct() {
1111 parent::__construct( 'ReviewedPages' );
12 - }
 12+ }
1313
1414 public function execute( $par ) {
1515 global $wgRequest, $wgUser;
Index: trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php
@@ -8,11 +8,11 @@
99 class StablePages extends SpecialPage
1010 {
1111 public function __construct() {
12 - parent::__construct( 'StablePages' );
13 - }
 12+ parent::__construct( 'StablePages' );
 13+ }
1414
1515 public function execute( $par ) {
16 - global $wgRequest, $wgUser;
 16+ global $wgRequest, $wgUser;
1717
1818 $this->setHeaders();
1919 $this->skin = $wgUser->getSkin();
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -177,23 +177,23 @@
178178 * @returns string
179179 * Generates a review box/tag
180180 */
181 - public static function addTagRatings( $flags, $prettyBox = false, $css = '' ) {
182 - $tag = '';
183 - if ( $prettyBox ) {
184 - $tag .= "<table id='mw-fr-revisionratings-box' align='center' class='$css' cellpadding='0'>";
 181+ public static function addTagRatings( $flags, $prettyBox = false, $css = '' ) {
 182+ $tag = '';
 183+ if ( $prettyBox ) {
 184+ $tag .= "<table id='mw-fr-revisionratings-box' align='center' class='$css' cellpadding='0'>";
185185 }
186186 foreach ( FlaggedRevs::getTags() as $quality ) {
187187 $level = isset( $flags[$quality] ) ? $flags[$quality] : 0;
188188 $encValueText = wfMsgHtml( "revreview-$quality-$level" );
189 - $level = $flags[$quality];
 189+ $level = $flags[$quality];
190190
191 - $levelmarker = $level * 20 + 20;
192 - if ( $prettyBox ) {
193 - $tag .= "<tr><td class='fr-text' valign='middle'>" .
 191+ $levelmarker = $level * 20 + 20;
 192+ if ( $prettyBox ) {
 193+ $tag .= "<tr><td class='fr-text' valign='middle'>" .
194194 wfMsgHtml( "revreview-$quality" ) .
195195 "</td><td class='fr-value$levelmarker' valign='middle'>" .
196196 $encValueText . "</td></tr>\n";
197 - } else {
 197+ } else {
198198 $tag .= "&#160;<span class='fr-marker-$levelmarker'><strong>" .
199199 wfMsgHtml( "revreview-$quality" ) .
200200 "</strong>: <span class='fr-text-value'>$encValueText&#160;</span>&#160;" .
@@ -204,7 +204,7 @@
205205 $tag .= '</table>';
206206 }
207207 return $tag;
208 - }
 208+ }
209209
210210 /**
211211 * @param FlaggedRevision $frev, the reviewed version
@@ -233,7 +233,7 @@
234234 } else {
235235 $color = 'flaggedrevs-color-1';
236236 }
237 - # Construct some tagging
 237+ # Construct some tagging
238238 if ( $synced && ( $type == 'stable' || $type == 'draft' ) ) {
239239 $msg = $quality ?
240240 'revreview-quality-same' : 'revreview-basic-same';
@@ -279,7 +279,7 @@
280280 }
281281 $box .= Xml::closeElement( 'div' ) . "\n";
282282 $box .= "</div>\n";
283 - return $box;
 283+ return $box;
284284 }
285285
286286 /**
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1323,7 +1323,7 @@
13241324 return true;
13251325 }
13261326
1327 - /**
 1327+ /**
13281328 * Record demotion so that auto-promote will be disabled
13291329 */
13301330 public static function recordDemote( $user, array $addgroup, array $removegroup ) {
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -301,7 +301,7 @@
302302 // set to override given the relevant conditions (like &stable=0) or there
303303 // is no stable version.
304304 } else {
305 - $this->showDraftVersion( $srev, $tag, $prot );
 305+ $this->showDraftVersion( $srev, $tag, $prot );
306306 }
307307 $encJS = ''; // JS events to use
308308 # Some checks for which tag CSS to use
@@ -1141,20 +1141,20 @@
11421142 // XXX: shouldn't the session slave position check handle this?
11431143 $flags = ( $action == 'rollback' ) ? FR_MASTER : 0;
11441144 $srev = $this->article->getStableRev( $flags );
1145 - if ( !$srev ) {
 1145+ if ( !$srev ) {
11461146 return true; // No stable revision exists
11471147 }
11481148 $synced = $this->article->stableVersionIsSynced();
11491149 $pendingEdits = !$synced && $this->article->isStableShownByDefault();
11501150 // Set the edit tab names as needed...
1151 - if ( $pendingEdits ) {
1152 - if ( isset( $views['edit'] ) ) {
 1151+ if ( $pendingEdits ) {
 1152+ if ( isset( $views['edit'] ) ) {
11531153 $views['edit']['text'] = wfMsg( 'revreview-edit' );
1154 - }
1155 - if ( isset( $views['viewsource'] ) ) {
 1154+ }
 1155+ if ( isset( $views['viewsource'] ) ) {
11561156 $views['viewsource']['text'] = wfMsg( 'revreview-source' );
11571157 }
1158 - }
 1158+ }
11591159 # Add "pending changes" tab if the page is not synced
11601160 if ( !$synced ) {
11611161 $this->addDraftTab( $views, $srev, $action, $type );
@@ -1168,18 +1168,18 @@
11691169 ) {
11701170 global $wgRequest, $wgOut;
11711171 $title = $this->article->getTitle(); // convenience
1172 - $tabs = array(
1173 - 'read' => array( // view stable
 1172+ $tabs = array(
 1173+ 'read' => array( // view stable
11741174 'text' => '', // unused
11751175 'href' => $title->getLocalUrl( 'stable=1' ),
1176 - 'class' => ''
1177 - ),
1178 - 'draft' => array( // view draft
 1176+ 'class' => ''
 1177+ ),
 1178+ 'draft' => array( // view draft
11791179 'text' => wfMsg( 'revreview-current' ),
11801180 'href' => $title->getLocalUrl( 'stable=0&redirect=no' ),
1181 - 'class' => 'collapsible'
1182 - ),
1183 - );
 1181+ 'class' => 'collapsible'
 1182+ ),
 1183+ );
11841184 // Set tab selection CSS
11851185 if ( $this->pageOverride() || $wgRequest->getVal( 'stableid' ) ) {
11861186 // We are looking a the stable version or an old reviewed one
@@ -1242,8 +1242,8 @@
12431243 }
12441244 }
12451245 }
1246 - // Replaces old tabs with new tabs
1247 - $views = $newViews;
 1246+ // Replaces old tabs with new tabs
 1247+ $views = $newViews;
12481248 }
12491249
12501250 /**
@@ -1566,7 +1566,7 @@
15671567 && $oldRev->getPage() == $newRev->getPage() // no multipage diffs
15681568 && $oldRev->getId() == $srev->getRevId()
15691569 && $newRev->getTimestamp() >= $oldRev->getTimestamp() // no backwards diffs
1570 - );
 1570+ );
15711571 }
15721572
15731573 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r80611Merge whitespace fixes from r78514 so they don't annoy medemon02:15, 20 January 2011

Status & tagging log