Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -986,7 +986,7 @@ |
987 | 987 | * LinksUpdate was already called via edit operations, so the page |
988 | 988 | * fields will be up to date. This updates the stable version. |
989 | 989 | */ |
990 | | - public static function autoReviewEdit( $article, $user, $text, $rev, $flags, $patrol = true ) { |
| 990 | + public static function autoReviewEdit( $article, $user, $text, $rev, $flags, $auto=true ) { |
991 | 991 | global $wgMemc; |
992 | 992 | wfProfileIn( __METHOD__ ); |
993 | 993 | # Default tags to level 1 for each dimension |
— | — | @@ -1067,13 +1067,9 @@ |
1068 | 1068 | 'fr_img_timestamp' => $fileData ? $fileData['timestamp'] : null, |
1069 | 1069 | 'fr_img_sha1' => $fileData ? $fileData['sha1'] : null |
1070 | 1070 | ) ); |
1071 | | - $flaggedRevision->insertOn( $tmpset, $imgset, true ); |
1072 | | - # Mark as patrolled |
1073 | | - if( $patrol ) { |
1074 | | - RevisionReview::updateRecentChanges( $title, $rev->getId() ); |
1075 | | - } |
| 1071 | + $flaggedRevision->insertOn( $tmpset, $imgset, $auto ); |
1076 | 1072 | # Update the article review log |
1077 | | - RevisionReview::updateLog( $title, $flags, array(), '', $rev->getId(), $oldSvId, true, true ); |
| 1073 | + RevisionReview::updateLog( $title, $flags, array(), '', $rev->getId(), $oldSvId, true, $auto ); |
1078 | 1074 | |
1079 | 1075 | # If we know that this is now the new stable version |
1080 | 1076 | # (which it probably is), save it to the cache... |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -666,38 +666,47 @@ |
667 | 667 | */ |
668 | 668 | public static function maybeMakeEditReviewed( $article, $rev, $baseRevId = false, $user = null ) { |
669 | 669 | global $wgFlaggedRevsAutoReview, $wgFlaggedRevsAutoReviewNew, $wgRequest; |
670 | | - # Get the user |
671 | | - $user = is_null($user) ? User::newFromId( $rev->getUser() ) : $user; |
672 | | - $checked = $wgRequest->getCheck('wpReviewEdit') && $user->isAllowed('review'); |
673 | | - if( $checked ) { |
674 | | - # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit... |
675 | | - FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, null, false ); |
| 670 | + # Must be in reviewable namespace |
| 671 | + $title = $article->getTitle(); |
| 672 | + if( !$rev || !FlaggedRevs::isPageReviewable( $title ) ) { |
676 | 673 | return true; |
677 | 674 | } |
| 675 | + $title->resetArticleID( $rev->getPage() ); // Avoid extra DB hit and lag issues |
| 676 | + # Get what was just the current revision ID |
| 677 | + $prevRevId = $rev->getParentId(); |
| 678 | + $prevTimestamp = $flags = null; |
| 679 | + # Get edit timestamp. Existance already valided by EditPage.php. If |
| 680 | + # not present, then it the rev shouldn't be saved, like null edits. |
| 681 | + $editTimestamp = $wgRequest->getVal('wpEdittime'); |
| 682 | + # Get the user who made the edit |
| 683 | + $user = is_null($user) ? User::newFromId( $rev->getUser() ) : $user; |
| 684 | + # Is the page checked off to be reviewed? |
| 685 | + if( $wgRequest->getCheck('wpReviewEdit') && $user->isAllowed('review') ) { |
| 686 | + if( $prevRevId ) { |
| 687 | + $prevTimestamp = Revision::getTimestampFromId( $title, $prevRevId ); // use PK |
| 688 | + } |
| 689 | + # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit. |
| 690 | + # Don't do so if an edit was auto-merged in between though... |
| 691 | + if( !$editTimestamp || !$prevTimestamp || $prevTimestamp == $editTimestamp ) { |
| 692 | + FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false ); |
| 693 | + return true; |
| 694 | + } |
| 695 | + } |
678 | 696 | # Auto-reviewing must be enabled |
679 | 697 | if( !$wgFlaggedRevsAutoReview ) return true; |
680 | 698 | # User must have the required permissions |
681 | | - if( !$user->isAllowed('autoreview') && !$user->isAllowed('bot') ) |
| 699 | + if( !$user->isAllowed('autoreview') && !$user->isAllowed('bot') ) { |
682 | 700 | return true; |
| 701 | + } |
683 | 702 | # If $baseRevId passed in, this is a null edit |
684 | 703 | $isNullEdit = $baseRevId ? true : false; |
685 | | - # Must be in reviewable namespace |
686 | | - $title = $article->getTitle(); |
687 | | - if( !FlaggedRevs::isPageReviewable( $title ) ) { |
688 | | - return true; |
689 | | - } |
690 | 704 | $frev = null; |
691 | 705 | $reviewableNewPage = false; |
692 | | - # Avoid extra DB hit and lag issues |
693 | | - $title->resetArticleID( $rev->getPage() ); |
694 | | - # Get what was just the current revision ID |
695 | | - $prevRevId = $rev->getParentId(); |
696 | 706 | # Get the revision ID the incoming one was based off... |
697 | 707 | if( !$baseRevId && $prevRevId ) { |
698 | | - $prevTimestamp = Revision::getTimestampFromId( $title, $prevRevId ); // use PK |
699 | | - # Get edit timestamp. Existance already valided by EditPage.php. If |
700 | | - # not present, then it shouldn't be, like null edits. |
701 | | - $editTimestamp = $wgRequest->getVal('wpEdittime'); |
| 708 | + if( is_null($prevTimestamp) ) { // may already be set |
| 709 | + $prevTimestamp = Revision::getTimestampFromId( $title, $prevRevId ); // use PK |
| 710 | + } |
702 | 711 | # The user just made an edit. The one before that should have |
703 | 712 | # been the current version. If not reflected in wpEdittime, an |
704 | 713 | # edit may have been auto-merged in between, in that case, discard |
— | — | @@ -729,11 +738,9 @@ |
730 | 739 | # Assume basic flagging level unless this is a null edit |
731 | 740 | if( $isNullEdit ) { |
732 | 741 | $flags = $frev->getTags(); |
733 | | - } else { |
734 | | - $flags = null; |
735 | 742 | } |
736 | 743 | # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit... |
737 | | - FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false ); |
| 744 | + FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags ); |
738 | 745 | } |
739 | 746 | return true; |
740 | 747 | } |