Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -58,11 +58,11 @@ |
59 | 59 | |
60 | 60 | $params = $this->extractRequestParams(); |
61 | 61 | |
62 | | - if (!is_null($params['user']) && !is_null($params['token'])) { |
63 | | - $user = User::newFromName($params['user']); |
| 62 | + if (!is_null($params['owner']) && !is_null($params['token'])) { |
| 63 | + $user = User::newFromName($params['owner']); |
64 | 64 | $token = $user->getOption('watchlisttoken'); |
65 | 65 | if ($token == '' || $token != $params['token']) { |
66 | | - $this->dieUsage('Incorrect watchlist token provided', 'bad_wltoken'); |
| 66 | + $this->dieUsage('Incorrect watchlist token provided -- please set a correct token in Special:Preferences', 'bad_wltoken'); |
67 | 67 | } |
68 | 68 | } elseif (!$wgUser->isLoggedIn()) { |
69 | 69 | $this->dieUsage('You must be logged-in to have a watchlist', 'notloggedin'); |
— | — | @@ -173,16 +173,12 @@ |
174 | 174 | $this->addWhereIf('rc_patrolled != 0', isset($show['patrolled'])); |
175 | 175 | } |
176 | 176 | |
177 | | - # Ignore extra user conditions if we're using token mode, since the |
178 | | - # user was already manually specified. |
179 | | - if(is_null($params['user']) || is_null($params['token'])) { |
180 | | - if(!is_null($params['user']) && !is_null($params['excludeuser'])) |
181 | | - $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser'); |
182 | | - if(!is_null($params['user'])) |
183 | | - $this->addWhereFld('rc_user_text', $params['user']); |
184 | | - if(!is_null($params['excludeuser'])) |
185 | | - $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser'])); |
186 | | - } |
| 177 | + if(!is_null($params['user']) && !is_null($params['excludeuser'])) |
| 178 | + $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser'); |
| 179 | + if(!is_null($params['user'])) |
| 180 | + $this->addWhereFld('rc_user_text', $params['user']); |
| 181 | + if(!is_null($params['excludeuser'])) |
| 182 | + $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser'])); |
187 | 183 | |
188 | 184 | |
189 | 185 | # This is an index optimization for mysql, as done in the Special:Watchlist page |
— | — | @@ -336,6 +332,9 @@ |
337 | 333 | '!patrolled', |
338 | 334 | ) |
339 | 335 | ), |
| 336 | + 'owner' => array ( |
| 337 | + ApiBase :: PARAM_TYPE => 'user' |
| 338 | + ), |
340 | 339 | 'token' => array ( |
341 | 340 | ApiBase :: PARAM_TYPE => 'string' |
342 | 341 | ) |
— | — | @@ -357,6 +356,7 @@ |
358 | 357 | 'Show only items that meet this criteria.', |
359 | 358 | 'For example, to see only minor edits done by logged-in users, set show=minor|!anon' |
360 | 359 | ), |
| 360 | + 'owner' => "The name of the user whose watchlist you'd like to access", |
361 | 361 | 'token' => "Give a security token (settable in preferences) to allow access to another user's watchlist" |
362 | 362 | ); |
363 | 363 | } |
— | — | @@ -371,7 +371,8 @@ |
372 | 372 | 'api.php?action=query&list=watchlist&wlprop=ids|title|timestamp|user|comment', |
373 | 373 | 'api.php?action=query&list=watchlist&wlallrev&wlprop=ids|title|timestamp|user|comment', |
374 | 374 | 'api.php?action=query&generator=watchlist&prop=info', |
375 | | - 'api.php?action=query&generator=watchlist&gwlallrev&prop=revisions&rvprop=timestamp|user' |
| 375 | + 'api.php?action=query&generator=watchlist&gwlallrev&prop=revisions&rvprop=timestamp|user', |
| 376 | + 'api.php?action=query&list=watchlist&wlowner=Bob_Smith&wltoken=d8d562e9725ea1512894cdab28e5ceebc7f20237' |
376 | 377 | ); |
377 | 378 | } |
378 | 379 | |
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php |
— | — | @@ -75,8 +75,8 @@ |
76 | 76 | 'wllimit' => (50 > $wgFeedLimit) ? $wgFeedLimit : 50 |
77 | 77 | ); |
78 | 78 | |
79 | | - if (!is_null($params['wluser'])) |
80 | | - $fauxReqArr['wluser'] = $params['wluser']; |
| 79 | + if (!is_null($params['wlowner'])) |
| 80 | + $fauxReqArr['wlowner'] = $params['wlowner']; |
81 | 81 | if (!is_null($params['wltoken'])) |
82 | 82 | $fauxReqArr['wltoken'] = $params['wltoken']; |
83 | 83 | |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | ApiBase :: PARAM_MAX => 72, |
160 | 160 | ), |
161 | 161 | 'allrev' => null, |
162 | | - 'wluser' => array ( |
| 162 | + 'wlowner' => array ( |
163 | 163 | ApiBase :: PARAM_TYPE => 'user' |
164 | 164 | ), |
165 | 165 | 'wltoken' => array ( |
— | — | @@ -172,7 +172,7 @@ |
173 | 173 | 'feedformat' => 'The format of the feed', |
174 | 174 | 'hours' => 'List pages modified within this many hours from now', |
175 | 175 | 'allrev' => 'Include multiple revisions of the same page within given timeframe.', |
176 | | - 'wluser' => "The user whose watchlist you want (must be accompanied by wltoken if it's not you)", |
| 176 | + 'wlowner' => "The user whose watchlist you want (must be accompanied by wltoken if it's not you)", |
177 | 177 | 'wltoken' => 'Security token that requested user set in their preferences' |
178 | 178 | ); |
179 | 179 | } |