|| ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
|| ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
|| ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
+ || ( isset( $show['unread'] ) && isset( $show['!unread'] ) )
) {
$this->dieUsageMsg( 'show' );
}
$this->addWhereIf( 'rc_user != 0', isset( $show['!anon'] ) );
$this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
$this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
+ $this->addWhereIf( 'wl_notificationtimestamp IS NOT NULL', isset( $show['unread'] ) );
+ $this->addWhereIf( 'wl_notificationtimestamp IS NULL', isset( $show['!unread'] ) );
}
if ( !is_null( $params['type'] ) ) {
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$bitmask = Revision::DELETED_USER;
- } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
+ } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$bitmask = Revision::DELETED_USER | Revision::DELETED_RESTRICTED;
} else {
$bitmask = 0;
// entirely from the watchlist, or someone could guess the title.
if ( !$user->isAllowed( 'deletedhistory' ) ) {
$bitmask = LogPage::DELETED_ACTION;
- } elseif ( !$user->isAllowed( 'suppressrevision' ) ) {
+ } elseif ( !$user->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$bitmask = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
} else {
$bitmask = 0;
'!anon',
'patrolled',
'!patrolled',
+ 'unread',
+ '!unread',
)
),
'type' => array(
);
}
- public function getResultProperties() {
- global $wgLogTypes;
-
- return array(
- '' => array(
- 'type' => array(
- ApiBase::PROP_TYPE => array(
- 'edit',
- 'new',
- 'move',
- 'log',
- 'move over redirect'
- )
- )
- ),
- 'ids' => array(
- 'pageid' => 'integer',
- 'revid' => 'integer',
- 'old_revid' => 'integer'
- ),
- 'title' => array(
- 'ns' => 'namespace',
- 'title' => 'string'
- ),
- 'user' => array(
- 'user' => 'string',
- 'anon' => 'boolean'
- ),
- 'userid' => array(
- 'userid' => 'integer',
- 'anon' => 'boolean'
- ),
- 'flags' => array(
- 'new' => 'boolean',
- 'minor' => 'boolean',
- 'bot' => 'boolean'
- ),
- 'patrol' => array(
- 'patrolled' => 'boolean'
- ),
- 'timestamp' => array(
- 'timestamp' => 'timestamp'
- ),
- 'sizes' => array(
- 'oldlen' => 'integer',
- 'newlen' => 'integer'
- ),
- 'notificationtimestamp' => array(
- 'notificationtimestamp' => array(
- ApiBase::PROP_TYPE => 'timestamp',
- ApiBase::PROP_NULLABLE => true
- )
- ),
- 'comment' => array(
- 'comment' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- )
- ),
- 'parsedcomment' => array(
- 'parsedcomment' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- )
- ),
- 'loginfo' => array(
- 'logid' => array(
- ApiBase::PROP_TYPE => 'integer',
- ApiBase::PROP_NULLABLE => true
- ),
- 'logtype' => array(
- ApiBase::PROP_TYPE => $wgLogTypes,
- ApiBase::PROP_NULLABLE => true
- ),
- 'logaction' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- )
- )
- );
- }
-
public function getDescription() {
return "Get all recent changes to pages in the logged in user's watchlist.";
}
- public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
- array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
- array(
- 'code' => 'bad_wltoken',
- 'info' => 'Incorrect watchlist token provided -- ' .
- 'please set a correct token in Special:Preferences'
- ),
- array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
- array( 'code' => 'patrol', 'info' => 'patrol property is not available' ),
- array( 'show' ),
- array(
- 'code' => 'permissiondenied',
- 'info' => 'You need the patrol right to request the patrolled flag'
- ),
- array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
- ) );
- }
-
public function getExamples() {
return array(
'api.php?action=query&list=watchlist',