Revision: 48515
Author: aaron
Date: 2009-03-18 07:55:19 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
(bug 18001) Rollback of null edit should restore flag
Modified Paths:
--------------
trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
trunk/phase3/docs/hooks.txt
trunk/phase3/includes/Article.php
Modified: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
===================================================================
--- trunk/extensions/FlaggedRevs/FlaggedRevs.class.php 2009-03-18 06:21:26 UTC
(rev 48514)
+++ trunk/extensions/FlaggedRevs/FlaggedRevs.class.php 2009-03-18 07:55:19 UTC
(rev 48515)
@@ -820,6 +820,26 @@
return $oldid;
}
+ /**
+ * Mark a revision as patrolled if needed
+ * @param Revision $rev
+ * @returns bool DB write query used
+ */
+ public static function markRevisionPatrolled( $rev ) {
+ $rcid = $rev->isUnpatrolled();
+ # Make sure it is now marked patrolled...
+ if( $rcid ) {
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->update( 'recentchanges',
+ array( 'rc_patrolled' => 1 ),
+ array( 'rc_id' => $rcid ),
+ __METHOD__
+ );
+ return true;
+ }
+ return false;
+ }
+
################# Page configuration functions #################
/**
@@ -827,7 +847,7 @@
* @param Title $title, page title
* @param bool $forUpdate, use master DB?
* @returns Array (select,override)
- */
+ */
public static function getPageVisibilitySettings( &$title,
$forUpdate=false ) {
$db = $forUpdate ? wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
$row = $db->selectRow( 'flaggedpage_config',
Modified: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
===================================================================
--- trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php 2009-03-18 06:21:26 UTC
(rev 48514)
+++ trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php 2009-03-18 07:55:19 UTC
(rev 48515)
@@ -784,9 +784,11 @@
}
/**
- * When an user makes a null-edit with the review checkbox ticked
+ * When an user makes a null-edit we sometimes want to review it...
*/
- public static function maybeNullEditReview( $article, $user, &$text,
&$summary, &$m, &$a, &$b, &$f, $rev ) {
+ public static function maybeNullEditReview( $article, $user, &$text,
&$summary, &$m, &$a, &$b,
+ &$f, $rev, &$s, $baseId )
+ {
global $wgRequest;
# Must be in reviewable namespace
$title = $article->getTitle();
@@ -794,9 +796,18 @@
if( !$user || $rev !== NULL || !FlaggedRevs::isPageReviewable(
$title ) ) {
return true;
}
- # Get the just the current revision ID
+ # Get the current revision ID
$rev = Revision::newFromTitle( $title );
$flags = null;
+ # Is this a rollback/undo that didn't change anything?
+ if( $rev && $baseId ) {
+ $frev = FlaggedRevision::newFromTitle( $title, $baseId
);
+ # Was the edit that we tried to revert to reviewed?
+ if( $frev ) {
+ FlaggedRevs::autoReviewEdit( $article, $user,
$rev->getText(), $rev, $flags, true );
+ FlaggedRevs::markRevisionPatrolled( $rev ); //
Make sure it is now marked patrolled...
+ }
+ }
# Get edit timestamp, it must exist.
$editTimestamp = $wgRequest->getVal('wpEdittime');
# Is the page checked off to be reviewed?
@@ -805,16 +816,7 @@
# Don't do so if an edit was auto-merged in between
though...
if( $rev->getTimestamp() == $editTimestamp ) {
FlaggedRevs::autoReviewEdit( $article, $user,
$rev->getText(), $rev, $flags, false );
- $rcid = $rev->isUnpatrolled();
- # Make sure it is now marked patrolled...
- if( $rcid ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->update( 'recentchanges',
- array( 'rc_patrolled' => 1 ),
- array( 'rc_id' => $rcid ),
- __METHOD__
- );
- }
+ FlaggedRevs::markRevisionPatrolled( $rev ); //
Make sure it is now marked patrolled...
return true; // done!
}
}
Modified: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt 2009-03-18 06:21:26 UTC (rev 48514)
+++ trunk/phase3/docs/hooks.txt 2009-03-18 07:55:19 UTC (rev 48515)
@@ -441,6 +441,7 @@
$section: (No longer used)
$flags: Flags passed to Article::doEdit()
$revision: New Revision of the article
+$baseRevId: the rev ID (or false) this edit was based on
'ArticleUndelete': When one or more revisions of an article are restored
$title: Title corresponding to the article restored
Modified: trunk/phase3/includes/Article.php
===================================================================
--- trunk/phase3/includes/Article.php 2009-03-18 06:21:26 UTC (rev 48514)
+++ trunk/phase3/includes/Article.php 2009-03-18 07:55:19 UTC (rev 48515)
@@ -1771,7 +1771,7 @@
$status->value['revision'] = $revision;
wfRunHooks( 'ArticleSaveComplete', array( &$this, &$user,
$text, $summary,
- $flags & EDIT_MINOR, null, null, &$flags, $revision,
&$status ) );
+ $flags & EDIT_MINOR, null, null, &$flags, $revision,
&$status, $baseRevId ) );
wfProfileOut( __METHOD__ );
return $status;
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs