'wllimit' => (50 > $wgFeedLimit) ? $wgFeedLimit : 50
);
- if (!is_null($params['wluser']))
- $fauxReqArr['wluser'] = $params['wluser'];
+ if (!is_null($params['wlowner']))
+ $fauxReqArr['wlowner'] = $params['wlowner'];
if (!is_null($params['wltoken']))
$fauxReqArr['wltoken'] = $params['wltoken'];
ApiBase :: PARAM_MAX => 72,
),
'allrev' => null,
- 'wluser' => array (
+ 'wlowner' => array (
ApiBase :: PARAM_TYPE => 'user'
),
'wltoken' => array (
'feedformat' => 'The format of the feed',
'hours' => 'List pages modified within this many hours from now',
'allrev' => 'Include multiple revisions of the same page within given timeframe.',
- 'wluser' => "The user whose watchlist you want (must be accompanied by wltoken if it's not you)",
+ 'wlowner' => "The user whose watchlist you want (must be accompanied by wltoken if it's not you)",
'wltoken' => 'Security token that requested user set in their preferences'
);
}
$params = $this->extractRequestParams();
- if (!is_null($params['user']) && !is_null($params['token'])) {
- $user = User::newFromName($params['user']);
+ if (!is_null($params['owner']) && !is_null($params['token'])) {
+ $user = User::newFromName($params['owner']);
$token = $user->getOption('watchlisttoken');
if ($token == '' || $token != $params['token']) {
- $this->dieUsage('Incorrect watchlist token provided', 'bad_wltoken');
+ $this->dieUsage('Incorrect watchlist token provided -- please set a correct token in Special:Preferences', 'bad_wltoken');
}
} elseif (!$wgUser->isLoggedIn()) {
$this->dieUsage('You must be logged-in to have a watchlist', 'notloggedin');
$this->addWhereIf('rc_patrolled != 0', isset($show['patrolled']));
}
- # Ignore extra user conditions if we're using token mode, since the
- # user was already manually specified.
- if(is_null($params['user']) || is_null($params['token'])) {
- if(!is_null($params['user']) && !is_null($params['excludeuser']))
- $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser');
- if(!is_null($params['user']))
- $this->addWhereFld('rc_user_text', $params['user']);
- if(!is_null($params['excludeuser']))
- $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser']));
- }
+ if(!is_null($params['user']) && !is_null($params['excludeuser']))
+ $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser');
+ if(!is_null($params['user']))
+ $this->addWhereFld('rc_user_text', $params['user']);
+ if(!is_null($params['excludeuser']))
+ $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser']));
# This is an index optimization for mysql, as done in the Special:Watchlist page
'!patrolled',
)
),
+ 'owner' => array (
+ ApiBase :: PARAM_TYPE => 'user'
+ ),
'token' => array (
ApiBase :: PARAM_TYPE => 'string'
)
'Show only items that meet this criteria.',
'For example, to see only minor edits done by logged-in users, set show=minor|!anon'
),
+ 'owner' => "The name of the user whose watchlist you'd like to access",
'token' => "Give a security token (settable in preferences) to allow access to another user's watchlist"
);
}
'api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment',
'api.php?action=query&list=watchlist&wlallrev&wlprop=ids|title|timestamp|user|comment',
'api.php?action=query&generator=watchlist&prop=info',
- 'api.php?action=query&generator=watchlist&gwlallrev&prop=revisions&rvprop=timestamp|user'
+ 'api.php?action=query&generator=watchlist&gwlallrev&prop=revisions&rvprop=timestamp|user',
+ 'api.php?action=query&list=watchlist&wlowner=Bob_Smith&wltoken=d8d562e9725ea1512894cdab28e5ceebc7f20237'
);
}