Index: trunk/extensions/FlaggedRevs/dataclasses/FlaggedRevision.php |
— | — | @@ -307,19 +307,15 @@ |
308 | 308 | 'fr_img_timestamp' => $dbw->timestampOrNull( $this->mFileTimestamp ), |
309 | 309 | 'fr_img_sha1' => $this->mFileSha1 |
310 | 310 | ); |
311 | | - # Update flagged revisions table |
312 | | - $dbw->replace( 'flaggedrevs', |
313 | | - array( array( 'fr_rev_id' ) ), $revRow, __METHOD__ ); |
314 | | - # Clear out any previous garbage... |
315 | | - $dbw->delete( 'flaggedtemplates', |
316 | | - array( 'ft_rev_id' => $this->getRevId() ), __METHOD__ ); |
| 311 | + # Update the main flagged revisions table... |
| 312 | + $dbw->insert( 'flaggedrevs', $revRow, __METHOD__, 'IGNORE' ); |
| 313 | + if ( !$dbw->affectedRows() ) { |
| 314 | + return false; // duplicate review |
| 315 | + } |
317 | 316 | # ...and insert template version data |
318 | 317 | if ( $tmpInsertRows ) { |
319 | 318 | $dbw->insert( 'flaggedtemplates', $tmpInsertRows, __METHOD__, 'IGNORE' ); |
320 | 319 | } |
321 | | - # Clear out any previous garbage... |
322 | | - $dbw->delete( 'flaggedimages', |
323 | | - array( 'fi_rev_id' => $this->getRevId() ), __METHOD__ ); |
324 | 320 | # ...and insert file version data |
325 | 321 | if ( $fileInsertRows ) { |
326 | 322 | $dbw->insert( 'flaggedimages', $fileInsertRows, __METHOD__, 'IGNORE' ); |
Index: trunk/extensions/FlaggedRevs/business/RevisionReviewForm.php |
— | — | @@ -367,7 +367,7 @@ |
368 | 368 | return true; // don't record if the same |
369 | 369 | } |
370 | 370 | |
371 | | - # Insert the review entry... |
| 371 | + # The new review entry... |
372 | 372 | $flaggedRevision = new FlaggedRevision( array( |
373 | 373 | 'rev' => $rev, |
374 | 374 | 'user_id' => $this->user->getId(), |
— | — | @@ -381,6 +381,11 @@ |
382 | 382 | 'fileVersions' => $fileVersions, |
383 | 383 | 'flags' => '' |
384 | 384 | ) ); |
| 385 | + # Delete the old review entry if it exists... |
| 386 | + if ( $oldFrev ) { |
| 387 | + $oldFrev->delete(); |
| 388 | + } |
| 389 | + # Insert the new review entry... |
385 | 390 | $flaggedRevision->insert(); |
386 | 391 | # Update recent changes... |
387 | 392 | $rcId = $rev->isUnpatrolled(); // int |