Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -361,21 +361,26 @@ |
362 | 362 | $wgUseRCPatrol = true; |
363 | 363 | } |
364 | 364 | |
365 | | -# Add review log and such |
| 365 | +# Add review log |
366 | 366 | $wgLogTypes[] = 'review'; |
367 | 367 | $wgLogNames['review'] = 'review-logpage'; |
368 | 368 | $wgLogHeaders['review'] = 'review-logpagetext'; |
369 | | -$wgLogActions['review/approve'] = 'review-logentry-app'; |
370 | | -$wgLogActions['review/approve2'] = 'review-logentry-app'; |
371 | | -$wgLogActions['review/unapprove'] = 'review-logentry-dis'; |
372 | | -$wgLogActions['review/unapprove2'] = 'review-logentry-dis'; |
| 369 | +# Various actions are used for log filtering ... |
| 370 | +$wgLogActions['review/approve'] = 'review-logentry-app'; // sighted |
| 371 | +$wgLogActions['review/approve2'] = 'review-logentry-app'; // quality |
| 372 | +$wgLogActions['review/approve-a'] = 'review-logentry-app'; // sighted (auto) |
| 373 | +$wgLogActions['review/approve2-a'] = 'review-logentry-app'; // quality (auto) |
| 374 | +$wgLogActions['review/unapprove'] = 'review-logentry-dis'; // was sighted |
| 375 | +$wgLogActions['review/unapprove2'] = 'review-logentry-dis'; // was quality |
373 | 376 | |
| 377 | +# Add stable version log |
374 | 378 | $wgLogTypes[] = 'stable'; |
375 | 379 | $wgLogNames['stable'] = 'stable-logpage'; |
376 | 380 | $wgLogHeaders['stable'] = 'stable-logpagetext'; |
377 | 381 | $wgLogActions['stable/config'] = 'stable-logentry'; |
378 | 382 | $wgLogActions['stable/reset'] = 'stable-logentry2'; |
379 | 383 | |
| 384 | +# B/C ... |
380 | 385 | $wgLogActions['rights/erevoke'] = 'rights-editor-revoke'; |
381 | 386 | |
382 | 387 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efFlaggedRevsSchemaUpdates'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -886,6 +886,11 @@ |
887 | 887 | $latestID = $latestID ? $latestID : $rev->getId(); // new pages, page row not added yet |
888 | 888 | |
889 | 889 | $title = $article->getTitle(); |
| 890 | + |
| 891 | + # Get current stable version ID (for logging) |
| 892 | + $oldSv = FlaggedRevision::newFromStable( $title, false, true ); |
| 893 | + $oldSvId = $oldSv ? $oldSv->getRevId() : 0; |
| 894 | + |
890 | 895 | # Rev ID is not put into parser on edit, so do the same here. |
891 | 896 | # Also, a second parse would be triggered otherwise. |
892 | 897 | $parseId = ($rev->getId() == $latestID) ? null : $rev->getId(); |
— | — | @@ -1008,7 +1013,7 @@ |
1009 | 1014 | $dbw->commit(); |
1010 | 1015 | |
1011 | 1016 | # Update the article review log |
1012 | | - RevisionReview::updateLog( $title, $flags, array(), wfMsgForContent('revreview-auto'), $rev->getID(), true, true ); |
| 1017 | + RevisionReview::updateLog( $title, $flags, array(), '', $rev->getId(), $oldSvId, true, true ); |
1013 | 1018 | |
1014 | 1019 | # If we know that this is now the new stable version |
1015 | 1020 | # (which it probably is), save it to the cache... |
— | — | @@ -1968,15 +1973,18 @@ |
1969 | 1974 | * @return bool true |
1970 | 1975 | */ |
1971 | 1976 | public static function reviewLogLine( $type = '', $action = '', $title = null, $paramArray = array(), &$c = '', &$r = '', $t = '' ) { |
| 1977 | + $actionsValid = array('approve','approve2','approve-a','approve2-a','unapprove','unapprove2'); |
1972 | 1978 | # Show link to page with oldid=x |
1973 | | - if( $type == 'review' && in_array($action,array('approve','approve2','unapprove','unapprove2')) ) { |
| 1979 | + if( $type == 'review' && in_array($action,$actionsValid) && is_object($title) && isset($paramArray[0]) ) { |
1974 | 1980 | global $wgUser; |
1975 | | - if( is_object($title) && isset($paramArray[0]) ) { |
1976 | | - $r = '(' . $wgUser->getSkin()->makeKnownLinkObj( $title, |
1977 | | - wfMsgHtml('diff'), "oldid={$paramArray[0]}&diff=prev") . ')'; |
1978 | | - $r .= ' (' . $wgUser->getSkin()->makeKnownLinkObj( $title, |
1979 | | - wfMsgHtml('review-logentry-id',$paramArray[0]), "oldid={$paramArray[0]}") . ')'; |
| 1981 | + if( !empty($paramArray[1]) ) { |
| 1982 | + $r = '(' . $wgUser->getSkin()->makeKnownLinkObj( $title, wfMsgHtml('review-logentry-diff'), |
| 1983 | + "oldid={$paramArray[1]}&diff={$paramArray[0]}") . ')'; |
| 1984 | + } else { |
| 1985 | + $r = '(' . wfMsgHtml('review-logentry-diff') . ')'; |
1980 | 1986 | } |
| 1987 | + $r .= ' (' . $wgUser->getSkin()->makeKnownLinkObj( $title, |
| 1988 | + wfMsgHtml('review-logentry-id',$paramArray[0]), "oldid={$paramArray[0]}&diff=prev") . ')'; |
1981 | 1989 | } |
1982 | 1990 | return true; |
1983 | 1991 | } |
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -34,6 +34,7 @@ |
35 | 35 | 'review-logentry-app' => 'reviewed [[$1]]', |
36 | 36 | 'review-logentry-dis' => 'depreciated a version of [[$1]]', |
37 | 37 | 'review-logentry-id' => 'revision ID $1', |
| 38 | + 'review-logentry-diff' => 'diff to stable', |
38 | 39 | 'review-logpage' => 'Review log', |
39 | 40 | 'review-logpagetext' => 'This is a log of changes to revisions\' [[{{MediaWiki:Validationpage}}|approval]] status for content pages. |
40 | 41 | See the [[Special:ReviewedPages|reviewed pages list]] for a list of approved pages.', |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -495,6 +495,10 @@ |
496 | 496 | } |
497 | 497 | |
498 | 498 | $article = new Article( $this->page ); |
| 499 | + # Get current stable version ID (for logging) |
| 500 | + $oldSv = FlaggedRevision::newFromStable( $this->page, false, true ); |
| 501 | + $oldSvId = $oldSv ? $oldSv->getRevId() : 0; |
| 502 | + |
499 | 503 | # Is this rev already flagged? |
500 | 504 | $flaggedOutput = false; |
501 | 505 | if( $oldfrev = FlaggedRevision::newFromTitle( $title, $rev->getId(), true, true ) ) { |
— | — | @@ -613,7 +617,7 @@ |
614 | 618 | $this->updateRecentChanges( $title, $dbw, $rev, $this->rcid ); |
615 | 619 | |
616 | 620 | # Update the article review log |
617 | | - $this->updateLog( $this->page, $this->dims, $this->oflags, $this->comment, $this->oldid, true ); |
| 621 | + $this->updateLog( $this->page, $this->dims, $this->oflags, $this->comment, $this->oldid, $oldSvId, true ); |
618 | 622 | |
619 | 623 | # Update the links tables as the stable version may now be the default page. |
620 | 624 | # Try using the parser cache first since we didn't actually edit the current version. |
— | — | @@ -662,6 +666,10 @@ |
663 | 667 | global $wgUser, $wgParser, $wgRevisionCacheExpiry, $wgMemc; |
664 | 668 | wfProfileIn( __METHOD__ ); |
665 | 669 | |
| 670 | + # Get current stable version ID (for logging) |
| 671 | + $oldSv = FlaggedRevision::newFromStable( $this->page, false, true ); |
| 672 | + $oldSvId = $oldSv ? $oldSv->getRevId() : 0; |
| 673 | + |
666 | 674 | $dbw = wfGetDB( DB_MASTER ); |
667 | 675 | $dbw->begin(); |
668 | 676 | # Delete from flaggedrevs table |
— | — | @@ -673,7 +681,7 @@ |
674 | 682 | $dbw->commit(); |
675 | 683 | |
676 | 684 | # Update the article review log |
677 | | - $this->updateLog( $this->page, $this->dims, $this->oflags, $this->comment, $this->oldid, false ); |
| 685 | + $this->updateLog( $this->page, $this->dims, $this->oflags, $this->comment, $this->oldid, $oldSvId, false ); |
678 | 686 | |
679 | 687 | # Kill any text cache |
680 | 688 | if( $wgRevisionCacheExpiry ) { |
— | — | @@ -770,14 +778,14 @@ |
771 | 779 | * @param array $dims |
772 | 780 | * @param array $oldDims |
773 | 781 | * @param string $comment |
774 | | - * @param int $revid |
775 | | - * @param bool $approve |
| 782 | + * @param int $revId, revision ID |
| 783 | + * @param int $sId, prior stable revision ID |
| 784 | + * @param bool $approve, approved? (otherwise unapproved) |
776 | 785 | * @param bool $auto |
777 | 786 | */ |
778 | | - public static function updateLog( $title, $dims, $oldDims, $comment, $oldid, $approve, $auto=false ) { |
| 787 | + public static function updateLog( $title, $dims, $oldDims, $comment, $revId, $stableId, $approve, $auto=false ) { |
779 | 788 | global $wgFlaggedRevsLogInRC; |
780 | | - $putInRC = $auto ? false : $wgFlaggedRevsLogInRC; // don't put these in RC |
781 | | - $log = new LogPage( 'review', $putInRC ); |
| 789 | + $log = new LogPage( 'review', ($auto ? false : $wgFlaggedRevsLogInRC) ); |
782 | 790 | # ID, accuracy, depth, style |
783 | 791 | $ratings = array(); |
784 | 792 | foreach( $dims as $quality => $level ) { |
— | — | @@ -785,15 +793,17 @@ |
786 | 794 | } |
787 | 795 | # Append comment with ratings |
788 | 796 | if( $approve ) { |
| 797 | + $comment = $auto ? wfMsgForContent('revreview-auto') : $comment; // override this |
789 | 798 | $rating = !empty($ratings) ? '[' . implode(', ',$ratings). ']' : ''; |
790 | 799 | $comment .= $comment ? " $rating" : $rating; |
791 | 800 | } |
| 801 | + # Sort into the proper action (useful for filtering) |
792 | 802 | if( $approve ) { |
793 | 803 | $action = (FlaggedRevs::isQuality($dims) || FlaggedRevs::isQuality($oldDims)) ? 'approve2' : 'approve'; |
794 | | - $log->addEntry( $action, $title, $comment, array($oldid) ); |
| 804 | + $action .= $auto ? "-a" : ""; |
795 | 805 | } else { |
796 | 806 | $action = FlaggedRevs::isQuality($oldDims) ? 'unapprove2' : 'unapprove'; |
797 | | - $log->addEntry( $action, $title, $comment, array($oldid) ); |
798 | 807 | } |
| 808 | + $log->addEntry( $action, $title, $comment, array($revId,$stableId) ); |
799 | 809 | } |
800 | 810 | } |