r98484 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98483‎ | r98484 | r98485 >
Date:22:53, 29 September 2011
Author:aaron
Status:ok
Tags:
Comment:
Made PHPStorm happier
Modified paths:
  • /trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/modules/review.js (modified) (history)
  • /trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ProblemChanges_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevsStats.php
@@ -202,7 +202,6 @@
203203 if ( FlaggedRevs::useOnlyIfProtected() ) {
204204 return array( $aveRT, $medianRT, $rPerTable ); // disabled
205205 }
206 - $nowUnix = wfTimestamp( TS_UNIX ); // current time in UNIX TS
207206 # Only go so far back...otherwise we will get garbage values due to
208207 # the fact that FlaggedRevs wasn't enabled until after a while.
209208 $dbr = wfGetDB( DB_SLAVE );
@@ -327,8 +326,8 @@
328327 $secondsR = 0; // total wait seconds for edits later reviewed
329328 $secondsP = 0; // total wait seconds for edits still pending
330329 $aveRT = $medianRT = 0;
 330+ $times = array();
331331 if ( $dbr->numRows( $res ) ) {
332 - $times = array();
333332 # Get the elapsed times revs were pending (flagged time - edit time)
334333 foreach ( $res as $row ) {
335334 $time = wfTimestamp(TS_UNIX,$row->nft) - wfTimestamp(TS_UNIX,$row->rt);
Index: trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php
@@ -4,7 +4,8 @@
55 */
66 class RevisionReviewForm extends FRGenericSubmitForm {
77 /* Form parameters which can be user given */
8 - protected $page = null; # Target page obj
 8+ protected $page = null; # Target Title obj
 9+ protected $article = null; # Target Page obj
910 protected $approve = false; # Approval requested
1011 protected $unapprove = false; # De-approval requested
1112 protected $reject = false; # Rejection requested
@@ -258,7 +259,7 @@
259260 if ( $this->getAction() === 'approve' ) {
260261 $rev = Revision::newFromTitle( $this->page, $this->oldid );
261262 # Check for archived/deleted revisions...
262 - if ( !$rev || $rev->mDeleted ) {
 263+ if ( !$rev || $rev->getVisibility() ) {
263264 return 'review_bad_oldid';
264265 }
265266 $oldFrev = FlaggedRevision::newFromTitle( $this->page, $this->oldid, FR_MASTER );
@@ -376,7 +377,7 @@
377378 }
378379
379380 # The new review entry...
380 - $flaggedRevision = new FlaggedRevision( array(
 381+ $flaggedRevision = new FlaggedRevision( array(
381382 'rev' => $rev,
382383 'user_id' => $this->user->getId(),
383384 'timestamp' => wfTimestampNow(),
@@ -416,8 +417,8 @@
417418 $this->newLastChangeTime = $flaggedRevision->getTimestamp();
418419
419420 wfProfileOut( __METHOD__ );
420 - return true;
421 - }
 421+ return true;
 422+ }
422423
423424 /**
424425 * @param FlaggedRevision $frev
@@ -451,8 +452,8 @@
452453 $this->newLastChangeTime = '';
453454
454455 wfProfileOut( __METHOD__ );
455 - return true;
456 - }
 456+ return true;
 457+ }
457458
458459 /**
459460 * Get a validation key from versioning metadata
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsXML.php
@@ -154,8 +154,9 @@
155155 * @return string, css color for this quality
156156 */
157157 public static function getQualityColor( $quality ) {
158 - if ( $quality === false )
 158+ if ( $quality === false ) {
159159 return 'flaggedrevs-color-0';
 160+ }
160161 switch( $quality ) {
161162 case 2:
162163 $css = 'flaggedrevs-color-3';
@@ -166,6 +167,8 @@
167168 case 0:
168169 $css = 'flaggedrevs-color-1';
169170 break;
 171+ default:
 172+ $css = '';
170173 }
171174 return $css;
172175 }
Index: trunk/extensions/FlaggedRevs/presentation/specialpages/reports/ProblemChanges_body.php
@@ -19,6 +19,8 @@
2020 $catTitle = Title::newFromText( $category );
2121 $this->category = is_null( $catTitle ) ? '' : $catTitle->getText();
2222 $feedType = $wgRequest->getVal( 'feed' );
 23+
 24+ $incLimit = 0;
2325 if ( $this->including() ) {
2426 $incLimit = $this->parseParams( $par ); // apply non-URL params
2527 }
@@ -254,6 +256,7 @@
255257 * Get the tags of the revisions of a page after a certain rev
256258 * @param integer $pageId, page ID
257259 * @param integer $revId, rev ID
 260+ * @return Array
258261 */
259262 protected static function getRevisionTags( $pageId, $revId ) {
260263 $tags = array();
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.js
@@ -24,7 +24,7 @@
2525 var somezero = false;
2626
2727 // Determine if this is a "quality" or "incomplete" review
28 - for( tag in wgFlaggedRevsParams.tags ) {
 28+ for( var tag in wgFlaggedRevsParams.tags ) {
2929 var controlName = "wp" + tag;
3030 var levels = document.getElementsByName(controlName);
3131 if( !levels.length ) continue;
@@ -33,7 +33,7 @@
3434 if( levels[0].nodeName == 'SELECT' ) {
3535 selectedlevel = levels[0].selectedIndex;
3636 } else if( levels[0].type == 'radio' ) {
37 - for( i = 0; i < levels.length; i++ ) {
 37+ for( var i = 0; i < levels.length; i++ ) {
3838 if( levels[i].checked ) {
3939 selectedlevel = i;
4040 break;
@@ -46,7 +46,7 @@
4747 }
4848
4949 // Get quality level for this tag
50 - qualityLevel = wgFlaggedRevsParams.tags[tag]['quality'];
 50+ var qualityLevel = wgFlaggedRevsParams.tags[tag]['quality'];
5151
5252 if( selectedlevel < qualityLevel ) {
5353 quality = false; // not a quality review
@@ -72,12 +72,12 @@
7373 * Update <select> color for the selected item
7474 */
7575 'updateRatingFormColors': function() {
76 - for( tag in wgFlaggedRevsParams.tags ) {
 76+ for( var tag in wgFlaggedRevsParams.tags ) {
7777 var controlName = "wp" + tag;
7878 var levels = document.getElementsByName(controlName);
7979 if( levels.length && levels[0].nodeName == 'SELECT' ) {
80 - selectedlevel = levels[0].selectedIndex;
81 - value = levels[0].getElementsByTagName('option')[selectedlevel].value;
 80+ var selectedlevel = levels[0].selectedIndex;
 81+ var value = levels[0].getElementsByTagName('option')[selectedlevel].value;
8282 levels[0].className = 'fr-rating-option-' + value;
8383 // Fix FF one-time jitter bug of changing an <option>
8484 levels[0].selectedIndex = null;
@@ -203,7 +203,7 @@
204204 }
205205 }
206206 // Send encoded function plus all arguments...
207 - post_data = 'action=ajax&rs=RevisionReview::AjaxReview';
 207+ var post_data = 'action=ajax&rs=RevisionReview::AjaxReview';
208208 for( var i=0; i<requestArgs.length; i++ ) {
209209 post_data += '&rsargs[]=' + encodeURIComponent( requestArgs[i] );
210210 }
@@ -272,7 +272,7 @@
273273 requestArgs.push( diffUIParams.getElementsByTagName('input')[0].value );
274274 requestArgs.push( diffUIParams.getElementsByTagName('input')[1].value );
275275 // Send encoded function plus all arguments...
276 - url_pars = '?action=ajax&rs=FlaggedPageView::AjaxBuildDiffHeaderItems';
 276+ var url_pars = '?action=ajax&rs=FlaggedPageView::AjaxBuildDiffHeaderItems';
277277 for( var i=0; i<requestArgs.length; i++ ) {
278278 url_pars += '&rsargs[]=' + encodeURIComponent(requestArgs[i]);
279279 }
@@ -349,7 +349,7 @@
350350 // Build notice to say that user is advertising...
351351 var msgkey = $('#mw-fr-input-refid').length
352352 ? 'revreview-adv-reviewing-c' // diff
353 - : 'revreview-adv-reviewing-p' // page
 353+ : 'revreview-adv-reviewing-p'; // page
354354 var $underReview = $(
355355 '<span class="fr-under-review">' + mw.message( msgkey ).escaped() + '</span>' );
356356 // Update notice to say that user is advertising...
@@ -375,7 +375,7 @@
376376 // Build notice to say that user is not advertising...
377377 var msgkey = $('#mw-fr-input-refid').length
378378 ? 'revreview-sadv-reviewing-c' // diff
379 - : 'revreview-sadv-reviewing-p' // page
 379+ : 'revreview-sadv-reviewing-p'; // page
380380 var $underReview = $(
381381 '<span class="fr-make-under-review">' +
382382 mw.message( msgkey )

Follow-up revisions

RevisionCommit summaryAuthorDate
r108165Backported a bit from r98484 to avoid a PHP notice in some casesaaron19:02, 5 January 2012

Status & tagging log