r68693 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68692‎ | r68693 | r68694 >
Date:00:53, 29 June 2010
Author:aaron
Status:ok
Tags:
Comment:
* Slight performance tweak for fetching $oldFrev
* Renamed $oldfrev -> $oldFrev
Modified paths:
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -405,11 +405,15 @@
406406 $oldSv = FlaggedRevision::newFromStable( $this->page, FR_MASTER );
407407
408408 # Is this rev already flagged? (re-review)
409 - if ( $oldSv && $rev->getId() == $oldSv->getRevId() ) {
410 - $oldfrev = $oldSv; // save a query
411 - } else {
412 - $oldfrev = FlaggedRevision::newFromTitle( $this->page, $rev->getId(), FR_MASTER );
 409+ $oldFrev = null;
 410+ if ( $oldSv ) { // stable rev exists
 411+ if ( $rev->getId() == $oldSv->getRevId() ) {
 412+ $oldFrev = $oldSv; // save a query
 413+ } else {
 414+ $oldFrev = FlaggedRevision::newFromTitle( $this->page, $rev->getId(), FR_MASTER );
 415+ }
413416 }
 417+
414418 # Be loose on templates that includes other files/templates dynamically.
415419 # Strict checking breaks randomized images/metatemplates...(bug 14580)
416420 global $wgUseCurrentTemplates, $wgUseCurrentImages;
@@ -431,15 +435,15 @@
432436 FlaggedRevs::clearIncludeVersionCache( $rev->getId() );
433437
434438 # Is this a duplicate review?
435 - if ( $oldfrev ) {
436 - $fileSha1 = $fileData ?
437 - $fileData['sha1'] : null; // stable upload version for file pages
 439+ if ( $oldFrev ) {
 440+ // stable upload version for file pages
 441+ $fileSha1 = $fileData ? $fileData['sha1'] : null;
438442 $synced = (
439 - $oldfrev->getTags() == $flags && // tags => quality
440 - $oldfrev->getFileSha1() == $fileSha1 &&
441 - $oldfrev->getComment() == $this->notes &&
442 - $oldfrev->getTemplateVersions() == $tmpParams &&
443 - $oldfrev->getFileVersions() == $imgParams
 443+ $oldFrev->getTags() == $flags && // tags => quality
 444+ $oldFrev->getFileSha1() == $fileSha1 &&
 445+ $oldFrev->getComment() == $this->notes &&
 446+ $oldFrev->getTemplateVersions() == $tmpParams &&
 447+ $oldFrev->getFileVersions() == $imgParams
444448 );
445449 # Don't review if the same
446450 if ( $synced ) {

Status & tagging log