|| ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
|| ( isset( $show['patrolled'] ) && isset( $show['unpatrolled'] ) )
|| ( isset( $show['!patrolled'] ) && isset( $show['unpatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['!autopatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['unpatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['!patrolled'] ) )
) {
$this->dieWithError( 'apierror-show' );
}
if ( isset( $show['patrolled'] )
|| isset( $show['!patrolled'] )
|| isset( $show['unpatrolled'] )
+ || isset( $show['autopatrolled'] )
+ || isset( $show['!autopatrolled'] )
) {
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
}
}
+ $this->addWhereIf( 'rc_patrolled != 2', isset( $show['!autopatrolled'] ) );
+ $this->addWhereIf( 'rc_patrolled = 2', isset( $show['autopatrolled'] ) );
+
// Don't throw log entries out the window here
$this->addWhereIf(
'page_is_redirect = 0 OR page_is_redirect IS NULL',
/* Add the patrolled flag */
if ( $this->fld_patrolled ) {
- $vals['patrolled'] = $row->rc_patrolled == 1;
+ $vals['patrolled'] = $row->rc_patrolled != 0;
$vals['unpatrolled'] = ChangesList::isUnpatrolled( $row, $user );
+ $vals['autopatrolled'] = $row->rc_patrolled == 2;
}
if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
'!redirect',
'patrolled',
'!patrolled',
- 'unpatrolled'
+ 'unpatrolled',
+ 'autopatrolled',
+ '!autopatrolled',
]
],
'limit' => [
if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
|| ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['!autopatrolled'] ) )
+ || ( isset( $show['autopatrolled'] ) && isset( $show['!patrolled'] ) )
|| ( isset( $show['top'] ) && isset( $show['!top'] ) )
|| ( isset( $show['new'] ) && isset( $show['!new'] ) )
) {
$this->addWhereIf( 'rev_minor_edit != 0', isset( $show['minor'] ) );
$this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
$this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
+ $this->addWhereIf( 'rc_patrolled != 2', isset( $show['!autopatrolled'] ) );
+ $this->addWhereIf( 'rc_patrolled = 2', isset( $show['autopatrolled'] ) );
$this->addWhereIf( $idField . ' != page_latest', isset( $show['!top'] ) );
$this->addWhereIf( $idField . ' = page_latest', isset( $show['top'] ) );
$this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) );
$this->addOption( 'LIMIT', $limit + 1 );
if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ||
- $this->fld_patrolled
+ isset( $show['autopatrolled'] ) || isset( $show['!autopatrolled'] ) || $this->fld_patrolled
) {
if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
$this->dieWithError( 'apierror-permissiondenied-patrolflag', 'permissiondenied' );
}
+ $isFilterset = isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ||
+ isset( $show['autopatrolled'] ) || isset( $show['!autopatrolled'] );
$this->addTables( 'recentchanges' );
$this->addJoinConds( [ 'recentchanges' => [
- isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ? 'JOIN' : 'LEFT JOIN',
+ $isFilterset ? 'JOIN' : 'LEFT JOIN',
[
// This is a crazy hack. recentchanges has no index on rc_this_oldid, so instead of adding
// one T19237 did a join using rc_user_text and rc_timestamp instead. Now rc_user_text is
}
if ( $this->fld_patrolled ) {
- $vals['patrolled'] = (bool)$row->rc_patrolled;
+ $vals['patrolled'] = $row->rc_patrolled != RecentChange::PRC_UNPATROLLED;
+ $vals['autopatrolled'] = $row->rc_patrolled == RecentChange::PRC_AUTOPATROLLED;
}
if ( $this->fld_size && !is_null( $row->rev_len ) ) {
'!minor',
'patrolled',
'!patrolled',
+ 'autopatrolled',
+ '!autopatrolled',
'top',
'!top',
'new',
}
if ( $this->fld_patrol ) {
$includeFields[] = WatchedItemQueryService::INCLUDE_PATROL_INFO;
+ $includeFields[] = WatchedItemQueryService::INCLUDE_AUTOPATROL_INFO;
}
if ( $this->fld_sizes ) {
$includeFields[] = WatchedItemQueryService::INCLUDE_SIZES;
&& isset( $show[WatchedItemQueryService::FILTER_NOT_ANON] ) )
|| ( isset( $show[WatchedItemQueryService::FILTER_PATROLLED] )
&& isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
+ || ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
+ && isset( $show[WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED] ) )
+ || ( isset( $show[WatchedItemQueryService::FILTER_AUTOPATROLLED] )
+ && isset( $show[WatchedItemQueryService::FILTER_NOT_PATROLLED] ) )
|| ( isset( $show[WatchedItemQueryService::FILTER_UNREAD] )
&& isset( $show[WatchedItemQueryService::FILTER_NOT_UNREAD] ) );
}
/* Add the patrolled flag */
if ( $this->fld_patrol ) {
- $vals['patrolled'] = $recentChangeInfo['rc_patrolled'] == 1;
+ $vals['patrolled'] = $recentChangeInfo['rc_patrolled'] != 0;
$vals['unpatrolled'] = ChangesList::isUnpatrolled( (object)$recentChangeInfo, $user );
+ $vals['autopatrolled'] = $recentChangeInfo['rc_patrolled'] == 2;
}
if ( $this->fld_loginfo && $recentChangeInfo['rc_type'] == RC_LOG ) {
WatchedItemQueryService::FILTER_NOT_ANON,
WatchedItemQueryService::FILTER_PATROLLED,
WatchedItemQueryService::FILTER_NOT_PATROLLED,
+ WatchedItemQueryService::FILTER_AUTOPATROLLED,
+ WatchedItemQueryService::FILTER_NOT_AUTOPATROLLED,
WatchedItemQueryService::FILTER_UNREAD,
WatchedItemQueryService::FILTER_NOT_UNREAD,
]
"apihelp-query+recentchanges-paramvalue-prop-sizes": "Adds the new and old page length in bytes.",
"apihelp-query+recentchanges-paramvalue-prop-redirect": "Tags edit if page is a redirect.",
"apihelp-query+recentchanges-paramvalue-prop-patrolled": "Tags patrollable edits as being patrolled or unpatrolled.",
+ "apihelp-query+recentchanges-paramvalue-prop-autopatrolled": "Tags patrollable edits as being autopatrolled or not.",
"apihelp-query+recentchanges-paramvalue-prop-loginfo": "Adds log information (log ID, log type, etc) to log entries.",
"apihelp-query+recentchanges-paramvalue-prop-tags": "Lists tags for the entry.",
"apihelp-query+recentchanges-paramvalue-prop-sha1": "Adds the content checksum for entries associated with a revision.",
"apihelp-query+usercontribs-paramvalue-prop-sizediff": "Adds the size delta of the edit against its parent.",
"apihelp-query+usercontribs-paramvalue-prop-flags": "Adds flags of the edit.",
"apihelp-query+usercontribs-paramvalue-prop-patrolled": "Tags patrolled edits.",
+ "apihelp-query+usercontribs-paramvalue-prop-autopatrolled": "Tags autopatrolled edits.",
"apihelp-query+usercontribs-paramvalue-prop-tags": "Lists tags for the edit.",
"apihelp-query+usercontribs-param-show": "Show only items that meet these criteria, e.g. non minor edits only: <kbd>$2show=!minor</kbd>.\n\nIf <kbd>$2show=patrolled</kbd> or <kbd>$2show=!patrolled</kbd> is set, revisions older than <var>[[mw:Special:MyLanguage/Manual:$wgRCMaxAge|$wgRCMaxAge]]</var> ($1 {{PLURAL:$1|second|seconds}}) won't be shown.",
"apihelp-query+usercontribs-param-tag": "Only list revisions tagged with this tag.",
"apihelp-query+watchlist-paramvalue-prop-parsedcomment": "Adds parsed comment of the edit.",
"apihelp-query+watchlist-paramvalue-prop-timestamp": "Adds timestamp of the edit.",
"apihelp-query+watchlist-paramvalue-prop-patrol": "Tags edits that are patrolled.",
+ "apihelp-query+watchlist-paramvalue-prop-autopatrol": "Tags edits that are autopatrolled.",
"apihelp-query+watchlist-paramvalue-prop-sizes": "Adds the old and new lengths of the page.",
"apihelp-query+watchlist-paramvalue-prop-notificationtimestamp": "Adds timestamp of when the user was last notified about the edit.",
"apihelp-query+watchlist-paramvalue-prop-loginfo": "Adds log information where appropriate.",
"apihelp-query+recentchanges-paramvalue-prop-sizes": "{{doc-apihelp-paramvalue|query+recentchanges|prop|sizes}}",
"apihelp-query+recentchanges-paramvalue-prop-redirect": "{{doc-apihelp-paramvalue|query+recentchanges|prop|redirect}}",
"apihelp-query+recentchanges-paramvalue-prop-patrolled": "{{doc-apihelp-paramvalue|query+recentchanges|prop|patrolled}}",
+ "apihelp-query+recentchanges-paramvalue-prop-autopatrolled": "{{doc-apihelp-paramvalue|query+recentchanges|prop|autopatrolled}}",
"apihelp-query+recentchanges-paramvalue-prop-loginfo": "{{doc-apihelp-paramvalue|query+recentchanges|prop|loginfo}}",
"apihelp-query+recentchanges-paramvalue-prop-tags": "{{doc-apihelp-paramvalue|query+recentchanges|prop|tags}}",
"apihelp-query+recentchanges-paramvalue-prop-sha1": "{{doc-apihelp-paramvalue|query+recentchanges|prop|sha1}}",
"apihelp-query+usercontribs-paramvalue-prop-sizediff": "{{doc-apihelp-paramvalue|query+usercontribs|prop|sizediff}}",
"apihelp-query+usercontribs-paramvalue-prop-flags": "{{doc-apihelp-paramvalue|query+usercontribs|prop|flags}}",
"apihelp-query+usercontribs-paramvalue-prop-patrolled": "{{doc-apihelp-paramvalue|query+usercontribs|prop|patrolled}}",
+ "apihelp-query+usercontribs-paramvalue-prop-autopatrolled": "{{doc-apihelp-paramvalue|query+usercontribs|prop|autopatrolled}}",
"apihelp-query+usercontribs-paramvalue-prop-tags": "{{doc-apihelp-paramvalue|query+usercontribs|prop|tags}}",
"apihelp-query+usercontribs-param-show": "{{doc-apihelp-param|query+usercontribs|show|params=* $1 - Value of [[mw:Manual:$RCMaxAge|$RCMaxAge]]|paramstart=2}}",
"apihelp-query+usercontribs-param-tag": "{{doc-apihelp-param|query+usercontribs|tag}}",
"apihelp-query+watchlist-paramvalue-prop-parsedcomment": "{{doc-apihelp-paramvalue|query+watchlist|prop|parsedcomment}}",
"apihelp-query+watchlist-paramvalue-prop-timestamp": "{{doc-apihelp-paramvalue|query+watchlist|prop|timestamp}}",
"apihelp-query+watchlist-paramvalue-prop-patrol": "{{doc-apihelp-paramvalue|query+watchlist|prop|patrol}}",
+ "apihelp-query+watchlist-paramvalue-prop-autopatrol": "{{doc-apihelp-paramvalue|query+watchlist|prop|autopatrol}}",
"apihelp-query+watchlist-paramvalue-prop-sizes": "{{doc-apihelp-paramvalue|query+watchlist|prop|sizes}}",
"apihelp-query+watchlist-paramvalue-prop-notificationtimestamp": "{{doc-apihelp-paramvalue|query+watchlist|prop|notificationtimestamp}}",
"apihelp-query+watchlist-paramvalue-prop-loginfo": "{{doc-apihelp-paramvalue|query+watchlist|prop|loginfo}}",
const SRC_EXTERNAL = 'mw.external'; // obsolete
const SRC_CATEGORIZE = 'mw.categorize';
+ const PRC_UNPATROLLED = 0;
+ const PRC_PATROLLED = 1;
+ const PRC_AUTOPATROLLED = 2;
+
public $mAttribs = [];
public $mExtra = [];
[ 'modifyField', 'revision', 'rev_text_id', 'patch-rev_text_id-default.sql' ],
[ 'modifyTable', 'site_stats', 'patch-site_stats-modify.sql' ],
[ 'populateArchiveRevId' ],
+ [ 'modifyField', 'recentchanges', 'rc_patrolled', 'patch-rc_patrolled_type.sql' ],
];
}
// Log the autopatrol if the log entry is patrollable
if ( $this->getIsPatrollable() &&
- $rc->getAttribute( 'rc_patrolled' ) === 1
+ $rc->getAttribute( 'rc_patrolled' ) === 2
) {
PatrolLog::record( $rc, true, $this->getPerformer() );
}
// Update recentchanges
if ( !( $flags & EDIT_SUPPRESS_RC ) ) {
// Mark as patrolled if the user can do so
- $patrolled = $wgUseRCPatrol && !count(
+ $autopatrolled = $wgUseRCPatrol && !count(
$this->mTitle->getUserPermissionsErrors( 'autopatrol', $user ) );
// Add RC row to the DB
RecentChange::notifyEdit(
$oldContent ? $oldContent->getSize() : 0,
$newsize,
$revisionId,
- $patrolled,
+ $autopatrolled ? RecentChange::PRC_AUTOPATROLLED :
+ RecentChange::PRC_UNPATROLLED,
$tags
);
}
const INCLUDE_USER_ID = 'userid';
const INCLUDE_COMMENT = 'comment';
const INCLUDE_PATROL_INFO = 'patrol';
+ const INCLUDE_AUTOPATROL_INFO = 'autopatrol';
const INCLUDE_SIZES = 'sizes';
const INCLUDE_LOG_INFO = 'loginfo';
const INCLUDE_TAGS = 'tags';
const FILTER_NOT_ANON = '!anon';
const FILTER_PATROLLED = 'patrolled';
const FILTER_NOT_PATROLLED = '!patrolled';
+ const FILTER_AUTOPATROLLED = 'autopatrolled';
+ const FILTER_NOT_AUTOPATROLLED = '!autopatrolled';
const FILTER_UNREAD = 'unread';
const FILTER_NOT_UNREAD = '!unread';
const FILTER_CHANGED = 'changed';
} elseif ( in_array( self::FILTER_NOT_PATROLLED, $options['filters'] ) ) {
$conds[] = 'rc_patrolled = 0';
}
+
+ if ( in_array( self::FILTER_AUTOPATROLLED, $options['filters'] ) ) {
+ $conds[] = 'rc_patrolled = 2';
+ } elseif ( in_array( self::FILTER_NOT_AUTOPATROLLED, $options['filters'] ) ) {
+ $conds[] = 'rc_patrolled != 2';
+ }
}
if ( in_array( self::FILTER_UNREAD, $options['filters'] ) ) {
--- /dev/null
+DECLARE @cname sysname;--
+
+SELECT @cname = dc.name
+FROM sys.default_constraints dc
+JOIN sys.columns c
+ ON c.object_id = dc.parent_object_id
+ AND c.column_id = dc.parent_column_id
+WHERE
+ c.name = 'rc_patrolled'
+ AND c.object_id = OBJECT_ID('/*_*/recentchanges', 'U');--
+
+IF @cname IS NOT NULL
+BEGIN;--
+ DECLARE @sql nvarchar(max);--
+ SET @sql = N'ALTER TABLE /*_*/recentchanges DROP CONSTRAINT ' + @cname;--
+ EXEC sp_executesql @sql;--
+END;--
+
+DROP INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges;--
+ALTER TABLE /*_*/recentchanges ALTER COLUMN rc_patrolled tinyint NOT NULL;--
+ALTER TABLE /*_*/recentchanges ADD CONSTRAINT DF_rc_patrolled DEFAULT 0 FOR rc_patrolled;--
+CREATE INDEX /*i*/rc_name_type_patrolled_timestamp ON /*_*/recentchanges (rc_namespace, rc_type, rc_patrolled, rc_timestamp);
\ No newline at end of file
-- If the Recent Changes Patrol option is enabled,
-- users may mark edits as having been reviewed to
-- remove a warning flag on the RC list.
- -- A value of 1 indicates the page has been reviewed.
- rc_patrolled bit NOT NULL default 0,
+ -- A value of 1 indicates the page has been reviewed manually.
+ -- A value of 2 indicates the page has been automatically reviewed.
+ rc_patrolled tinyint NOT NULL CONSTRAINT DF_rc_patrolled DEFAULT 0
-- Recorded IP address the edit was made from, if the
-- $wgPutIPinRC option is enabled.
'type' => 'new',
'patrolled' => true,
'unpatrolled' => false,
+ 'autopatrolled' => false,
]
],
$this->getItemsFromApiResponse( $result )
'type' => 'new',
'patrolled' => true,
'unpatrolled' => false,
+ 'autopatrolled' => false,
]
],
$this->getItemsFromApiResponse( $resultPatrolled )